Skip to content

Fix LSP references for using alias #78819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 5, 2025

Conversation

dibarbet
Copy link
Member

@dibarbet dibarbet commented Jun 4, 2025

No bug link, just hit error here when I was investigating something else. It was attempting to create a decompiled location for the definition because it had no DocumentSpan

2025-06-04 13:00:56.667 [info] [Error - 1:00:56 PM] [textDocument/references] [LSP] System.InvalidOperationException: Unexpected value 'MyType' of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.AliasSymbol'
   at Microsoft.CodeAnalysis.MetadataAsSource.MetadataAsSourceHelpers.GetTopLevelContainingNamedType(ISymbol symbol) in /_/src/Features/Core/Portable/MetadataAsSource/MetadataAsSourceHelpers.cs:line 51
   at Microsoft.CodeAnalysis.MetadataAsSource.DecompilationMetadataAsSourceFileProvider.GetGeneratedFileAsync(MetadataAsSourceWorkspace metadataWorkspace, Workspace sourceWorkspace, Project sourceProject, ISymbol symbol, Boolean signaturesOnly, MetadataAsSourceOptions options, String tempPath, TelemetryMessage telemetryMessage, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/MetadataAsSource/DecompilationMetadataAsSourceFileProvider.cs:line 78
   at Microsoft.CodeAnalysis.MetadataAsSource.MetadataAsSourceFileService.GetGeneratedFileAsync(Workspace sourceWorkspace, Project sourceProject, ISymbol symbol, Boolean signaturesOnly, MetadataAsSourceOptions options, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/MetadataAsSource/MetadataAsSourceFileService.cs:line 108
   at Microsoft.CodeAnalysis.LanguageServer.Handler.FindUsagesLSPContext.ComputeLocationAsync(Nullable`1 documentSpan, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/References/FindUsagesLSPContext.cs:line 265

@dibarbet dibarbet requested a review from a team as a code owner June 4, 2025 20:28
@dibarbet dibarbet requested a review from CyrusNajmabadi June 4, 2025 20:28
@dibarbet dibarbet requested a review from JoeRobich June 5, 2025 00:05
@dibarbet dibarbet merged commit f111c95 into dotnet:main Jun 5, 2025
25 checks passed
@dibarbet dibarbet deleted the fix_using_alias_reference branch June 5, 2025 18:06
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants