vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Request textDocument/diagnostic failed. Message: The solution does not contain the specified document.

Open glen-84 opened this issue 6 months ago • 13 comments

Type: Bug

Issue Description

Request textDocument/diagnostic failed. Message: The solution does not contain the specified document. Code: -32000 [object Object]

Image

This is driving me crazy.

Steps to Reproduce

Not sure yet. I'm working with the GraphQL Platform repository. I'll update this issue if I can find simple steps to reproduce the error.

Expected Behavior

No errors.

Actual Behavior

The above error keeps showing up, multiple times, when opening and closing certain files, and I think also while staging files, etc.

Logs

C# log

2025-07-13 12:20:02.842 [info] [Error - 12:20:02 PM] [workspace/diagnostic] [LSP] System.InvalidOperationException: The solution does not contain the specified document.
   at Microsoft.CodeAnalysis.Workspaces.Diagnostics.DiagnosticAnalysisResultBuilder.AddDiagnostic(Dictionary`2& lazyLocals, SyntaxTree tree, Diagnostic diagnostic) in /_/src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResultBuilder.cs:line 157
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.<ToResultBuilderMapAsync>g__AddDiagnosticsToResult|8_1(ImmutableArray`1 diagnostics, DiagnosticAnalysisResultBuilder& result, SyntaxTree tree, DocumentId additionalDocumentId, Nullable`1 span, AnalysisKind kind, ImmutableArray`1 diagnosticIdsToFilter) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 291
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.ToResultBuilderMapAsync(AnalysisResultPair analysisResult, ImmutableArray`1 additionalPragmaSuppressionDiagnostics, DocumentAnalysisScope documentAnalysisScope, Project project, ImmutableArray`1 projectAnalyzers, ImmutableArray`1 hostAnalyzers, SkippedHostAnalyzersInfo skippedAnalyzersInfo, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeInProcAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzersPair compilationWithAnalyzers, RemoteHostClient client, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 107
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.<>c__DisplayClass7_0.<<AnalyzeAsync>g__AnalyzeCoreAsync|0>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 75
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzersPair compilationWithAnalyzers, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 60
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.<>c__DisplayClass15_0.<<ComputeDiagnosticAnalysisResultsAsync>g__ComputeDiagnosticsForAnalyzersAsync|1>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs:line 100
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.ComputeDiagnosticAnalysisResultsAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, Project project, ImmutableArray`1 analyzers, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs:line 38
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.<>c__DisplayClass20_0.<<ProduceProjectDiagnosticsAsync>g__GetOrComputeDiagnosticAnalysisResultsAsync|3>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnostics.cs:line 133
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.ProduceProjectDiagnosticsAsync(Project project, ImmutableHashSet`1 diagnosticIds, Func`2 shouldIncludeAnalyzer, IReadOnlyList`1 documentIds, Boolean includeLocalDocumentDiagnostics, Boolean includeNonLocalDocumentDiagnostics, Boolean includeProjectNonLocalResult, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnostics.cs:line 70
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractWorkspaceDocumentDiagnosticSource.FullSolutionAnalysisDiagnosticSource.<GetProjectDiagnosticsAsync>b__5_2(CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractWorkspaceDocumentDiagnosticSource.cs:line 80
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractWorkspaceDocumentDiagnosticSource.FullSolutionAnalysisDiagnosticSource.GetProjectDiagnosticsAsync(CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractWorkspaceDocumentDiagnosticSource.cs:line 69
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractWorkspaceDocumentDiagnosticSource.FullSolutionAnalysisDiagnosticSource.GetDiagnosticsAsync(RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractWorkspaceDocumentDiagnosticSource.cs:line 56
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.DiagnosticsPullCache.ComputeDataAsync(DiagnosticsRequestState state, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsPullCache.cs:line 49
   at Microsoft.CodeAnalysis.LanguageServer.Handler.VersionedPullCache`4.CacheItem.UpdateCacheItemAsync(VersionedPullCache`4 cache, Nullable`1 previousPullResult, Boolean isFullyLoaded, TState state, String language, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.LanguageServer.Handler.VersionedPullCache`4.GetOrComputeNewDataAsync(Dictionary`2 idToClientLastResult, ProjectOrDocumentId projectOrDocumentId, Project project, TState state, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.HandleRequestAsync(TDiagnosticsParams diagnosticsParams, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs:line 159
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
2025-07-13 12:20:02.843 [info] [Error - 12:20:02 PM] Request textDocument/diagnostic failed.
2025-07-13 12:20:02.843 [info]   Message: The solution does not contain the specified document.
  Code: -32000 
[object Object]
2025-07-13 12:20:02.844 [info] [Error - 12:20:02 PM] Workspace diagnostic pull failed.
2025-07-13 12:20:02.844 [info]   Message: The solution does not contain the specified document.
  Code: -32000 
[object Object]
2025-07-13 12:20:10.083 [info] [Error - 12:20:10 PM] [workspace/diagnostic] [LSP] System.ArgumentException: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.VerifyTree(SyntaxTree tree) in /_/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs:line 208
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzersPair.GetAnalysisResultAsync(SyntaxTree tree, Nullable`1 filterSpan, ImmutableArray`1 projectAnalyzers, ImmutableArray`1 hostAnalyzers, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/CompilationWithAnalyzersPair.cs:line 80
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 352
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, Project project, DiagnosticAnalyzerInfoCache analyzerInfoCache, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 327
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeInProcAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzersPair compilationWithAnalyzers, RemoteHostClient client, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 89
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.<>c__DisplayClass7_0.<<AnalyzeAsync>g__AnalyzeCoreAsync|0>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 75
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzersPair compilationWithAnalyzers, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 60
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.GetAnalysisResultAsync(DocumentAnalysisScope analysisScope, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 158
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.GetSyntaxDiagnosticsAsync(DiagnosticAnalyzer analyzer, Boolean isCompilerAnalyzer, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 214
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.ComputeDiagnosticsAsync(DiagnosticAnalyzer analyzer, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 121
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.ComputeDocumentDiagnosticsForAnalyzerCoreAsync(DiagnosticAnalyzer analyzer, DocumentAnalysisExecutor executor, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 47
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.ComputeDocumentDiagnosticsCoreAsync(DocumentAnalysisExecutor executor, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 33
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.<>c__DisplayClass23_0.<<GetDiagnosticsForSpanAsync>g__ComputeDocumentDiagnosticsAsync|3>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 250
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.<>c__DisplayClass23_0.<<GetDiagnosticsForSpanAsync>g__GetAsync|1>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 155
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.GetDiagnosticsForSpanAsync(TextDocument document, Nullable`1 range, Func`2 shouldIncludeDiagnostic, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKind, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 86
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.GetDiagnosticsForSpanAsync(TextDocument document, Nullable`1 range, Func`2 shouldIncludeDiagnostic, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKinds, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService.cs:line 113
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractWorkspaceDocumentDiagnosticSource.FullSolutionAnalysisDiagnosticSource.GetDiagnosticsAsync(RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractWorkspaceDocumentDiagnosticSource.cs:line 49
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.DiagnosticsPullCache.ComputeDataAsync(DiagnosticsRequestState state, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsPullCache.cs:line 49
   at Microsoft.CodeAnalysis.LanguageServer.Handler.VersionedPullCache`4.CacheItem.UpdateCacheItemAsync(VersionedPullCache`4 cache, Nullable`1 previousPullResult, Boolean isFullyLoaded, TState state, String language, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.LanguageServer.Handler.VersionedPullCache`4.GetOrComputeNewDataAsync(Dictionary`2 idToClientLastResult, ProjectOrDocumentId projectOrDocumentId, Project project, TState state, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.HandleRequestAsync(TDiagnosticsParams diagnosticsParams, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs:line 159
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
2025-07-13 12:20:10.083 [info] [Error - 12:20:10 PM] Request textDocument/diagnostic failed.
2025-07-13 12:20:10.083 [info]   Message: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
  Code: -32000 
[object Object]
2025-07-13 12:20:10.083 [info] [Error - 12:20:10 PM] Workspace diagnostic pull failed.
2025-07-13 12:20:10.083 [info]   Message: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
  Code: -32000 
[object Object]
2025-07-13 12:20:13.369 [info] [Error - 12:20:13 PM] [workspace/diagnostic] [LSP] System.ArgumentException: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.VerifyTree(SyntaxTree tree) in /_/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs:line 208
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzersPair.GetAnalysisResultAsync(SyntaxTree tree, Nullable`1 filterSpan, ImmutableArray`1 projectAnalyzers, ImmutableArray`1 hostAnalyzers, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/CompilationWithAnalyzersPair.cs:line 80
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 352
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, Project project, DiagnosticAnalyzerInfoCache analyzerInfoCache, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 327
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeInProcAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzersPair compilationWithAnalyzers, RemoteHostClient client, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 89
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.<>c__DisplayClass7_0.<<AnalyzeAsync>g__AnalyzeCoreAsync|0>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 75
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzersPair compilationWithAnalyzers, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 60
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.GetAnalysisResultAsync(DocumentAnalysisScope analysisScope, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 158
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.GetSyntaxDiagnosticsAsync(DiagnosticAnalyzer analyzer, Boolean isCompilerAnalyzer, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 214
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.ComputeDiagnosticsAsync(DiagnosticAnalyzer analyzer, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 121
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.ComputeDocumentDiagnosticsForAnalyzerCoreAsync(DiagnosticAnalyzer analyzer, DocumentAnalysisExecutor executor, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 47
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.ComputeDocumentDiagnosticsCoreAsync(DocumentAnalysisExecutor executor, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 33
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.<>c__DisplayClass23_0.<<GetDiagnosticsForSpanAsync>g__ComputeDocumentDiagnosticsAsync|3>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 250
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.<>c__DisplayClass23_0.<<GetDiagnosticsForSpanAsync>g__GetAsync|1>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 155
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.GetDiagnosticsForSpanAsync(TextDocument document, Nullable`1 range, Func`2 shouldIncludeDiagnostic, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKind, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 86
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.GetDiagnosticsForSpanAsync(TextDocument document, Nullable`1 range, Func`2 shouldIncludeDiagnostic, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKinds, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService.cs:line 113
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractWorkspaceDocumentDiagnosticSource.FullSolutionAnalysisDiagnosticSource.GetDiagnosticsAsync(RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractWorkspaceDocumentDiagnosticSource.cs:line 49
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.DiagnosticsPullCache.ComputeDataAsync(DiagnosticsRequestState state, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsPullCache.cs:line 49
   at Microsoft.CodeAnalysis.LanguageServer.Handler.VersionedPullCache`4.CacheItem.UpdateCacheItemAsync(VersionedPullCache`4 cache, Nullable`1 previousPullResult, Boolean isFullyLoaded, TState state, String language, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.LanguageServer.Handler.VersionedPullCache`4.GetOrComputeNewDataAsync(Dictionary`2 idToClientLastResult, ProjectOrDocumentId projectOrDocumentId, Project project, TState state, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.HandleRequestAsync(TDiagnosticsParams diagnosticsParams, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs:line 159
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
2025-07-13 12:20:13.370 [info] [Error - 12:20:13 PM] Request textDocument/diagnostic failed.
2025-07-13 12:20:13.370 [info]   Message: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
  Code: -32000 
[object Object]
2025-07-13 12:20:13.370 [info] [Error - 12:20:13 PM] Workspace diagnostic pull failed.
2025-07-13 12:20:13.370 [info]   Message: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
  Code: -32000 
[object Object]
2025-07-13 12:20:16.640 [info] [Error - 12:20:16 PM] [workspace/diagnostic] [LSP] System.ArgumentException: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.VerifyTree(SyntaxTree tree) in /_/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs:line 208
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzersPair.GetAnalysisResultAsync(SyntaxTree tree, Nullable`1 filterSpan, ImmutableArray`1 projectAnalyzers, ImmutableArray`1 hostAnalyzers, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/CompilationWithAnalyzersPair.cs:line 80
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 352
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, Project project, DiagnosticAnalyzerInfoCache analyzerInfoCache, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 327
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeInProcAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzersPair compilationWithAnalyzers, RemoteHostClient client, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 89
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.<>c__DisplayClass7_0.<<AnalyzeAsync>g__AnalyzeCoreAsync|0>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 75
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzersPair compilationWithAnalyzers, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 60
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.GetAnalysisResultAsync(DocumentAnalysisScope analysisScope, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 158
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.GetSyntaxDiagnosticsAsync(DiagnosticAnalyzer analyzer, Boolean isCompilerAnalyzer, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 214
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.ComputeDiagnosticsAsync(DiagnosticAnalyzer analyzer, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 121
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.ComputeDocumentDiagnosticsForAnalyzerCoreAsync(DiagnosticAnalyzer analyzer, DocumentAnalysisExecutor executor, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 47
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.ComputeDocumentDiagnosticsCoreAsync(DocumentAnalysisExecutor executor, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 33
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.<>c__DisplayClass23_0.<<GetDiagnosticsForSpanAsync>g__ComputeDocumentDiagnosticsAsync|3>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 250
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.<>c__DisplayClass23_0.<<GetDiagnosticsForSpanAsync>g__GetAsync|1>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 155
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.GetDiagnosticsForSpanAsync(TextDocument document, Nullable`1 range, Func`2 shouldIncludeDiagnostic, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKind, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 86
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.GetDiagnosticsForSpanAsync(TextDocument document, Nullable`1 range, Func`2 shouldIncludeDiagnostic, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKinds, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService.cs:line 113
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractWorkspaceDocumentDiagnosticSource.FullSolutionAnalysisDiagnosticSource.GetDiagnosticsAsync(RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractWorkspaceDocumentDiagnosticSource.cs:line 49
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.DiagnosticsPullCache.ComputeDataAsync(DiagnosticsRequestState state, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsPullCache.cs:line 49
   at Microsoft.CodeAnalysis.LanguageServer.Handler.VersionedPullCache`4.CacheItem.UpdateCacheItemAsync(VersionedPullCache`4 cache, Nullable`1 previousPullResult, Boolean isFullyLoaded, TState state, String language, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.LanguageServer.Handler.VersionedPullCache`4.GetOrComputeNewDataAsync(Dictionary`2 idToClientLastResult, ProjectOrDocumentId projectOrDocumentId, Project project, TState state, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.HandleRequestAsync(TDiagnosticsParams diagnosticsParams, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs:line 159
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
2025-07-13 12:20:16.641 [info] [Error - 12:20:16 PM] Request textDocument/diagnostic failed.
2025-07-13 12:20:16.641 [info]   Message: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
  Code: -32000 
[object Object]
2025-07-13 12:20:16.641 [info] [Error - 12:20:16 PM] Workspace diagnostic pull failed.
2025-07-13 12:20:16.641 [info]   Message: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
  Code: -32000 
[object Object]
2025-07-13 12:20:19.837 [info] [Error - 12:20:19 PM] [workspace/diagnostic] [LSP] System.ArgumentException: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.VerifyTree(SyntaxTree tree) in /_/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs:line 208
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzersPair.GetAnalysisResultAsync(SyntaxTree tree, Nullable`1 filterSpan, ImmutableArray`1 projectAnalyzers, ImmutableArray`1 hostAnalyzers, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/CompilationWithAnalyzersPair.cs:line 80
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 352
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, Project project, DiagnosticAnalyzerInfoCache analyzerInfoCache, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 327
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeInProcAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzersPair compilationWithAnalyzers, RemoteHostClient client, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 89
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.<>c__DisplayClass7_0.<<AnalyzeAsync>g__AnalyzeCoreAsync|0>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 75
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzersPair compilationWithAnalyzers, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/InProcOrRemoteHostAnalyzerRunner.cs:line 60
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.GetAnalysisResultAsync(DocumentAnalysisScope analysisScope, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 158
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.GetSyntaxDiagnosticsAsync(DiagnosticAnalyzer analyzer, Boolean isCompilerAnalyzer, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 214
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.ComputeDiagnosticsAsync(DiagnosticAnalyzer analyzer, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DocumentAnalysisExecutor.cs:line 121
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.ComputeDocumentDiagnosticsForAnalyzerCoreAsync(DiagnosticAnalyzer analyzer, DocumentAnalysisExecutor executor, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 47
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.ComputeDocumentDiagnosticsCoreAsync(DocumentAnalysisExecutor executor, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 33
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.<>c__DisplayClass23_0.<<GetDiagnosticsForSpanAsync>g__ComputeDocumentDiagnosticsAsync|3>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 250
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.<>c__DisplayClass23_0.<<GetDiagnosticsForSpanAsync>g__GetAsync|1>d.MoveNext() in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 155
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.DiagnosticIncrementalAnalyzer.GetDiagnosticsForSpanAsync(TextDocument document, Nullable`1 range, Func`2 shouldIncludeDiagnostic, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKind, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 86
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.GetDiagnosticsForSpanAsync(TextDocument document, Nullable`1 range, Func`2 shouldIncludeDiagnostic, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKinds, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService.cs:line 113
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractWorkspaceDocumentDiagnosticSource.FullSolutionAnalysisDiagnosticSource.GetDiagnosticsAsync(RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractWorkspaceDocumentDiagnosticSource.cs:line 49
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.DiagnosticsPullCache.ComputeDataAsync(DiagnosticsRequestState state, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsPullCache.cs:line 49
   at Microsoft.CodeAnalysis.LanguageServer.Handler.VersionedPullCache`4.CacheItem.UpdateCacheItemAsync(VersionedPullCache`4 cache, Nullable`1 previousPullResult, Boolean isFullyLoaded, TState state, String language, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.LanguageServer.Handler.VersionedPullCache`4.GetOrComputeNewDataAsync(Dictionary`2 idToClientLastResult, ProjectOrDocumentId projectOrDocumentId, Project project, TState state, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.HandleRequestAsync(TDiagnosticsParams diagnosticsParams, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs:line 159
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
2025-07-13 12:20:19.838 [info] [Error - 12:20:19 PM] Request textDocument/diagnostic failed.
2025-07-13 12:20:19.838 [info]   Message: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
  Code: -32000 
[object Object]
2025-07-13 12:20:19.838 [info] [Error - 12:20:19 PM] Workspace diagnostic pull failed.
2025-07-13 12:20:19.838 [info]   Message: Syntax tree doesn't belong to the underlying 'Compilation'. (Parameter 'tree')
  Code: -32000 
[object Object]

C# LSP Trace Logs

Post the output from Output-->C# LSP Trace Logs here. Requires the `C#` output window log level to be set to `Trace`

Environment information

VSCode version: 1.102.0 C# Extension: 2.84.19 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 10.0.100-preview.5.25277.114 Commit: ddf39a1b46 Workload version: 10.0.100-manifests.a07d1f1a MSBuild version: 17.15.0-preview-25277-114+ddf39a1b4

Runtime Environment: OS Name: Windows OS Version: 10.0.26100 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\10.0.100-preview.5.25277.114\

.NET workloads installed: There are no installed workloads to display. Configured to use workload sets when installing new manifests. Workloads are configured to install and update using workload versions, but none were found. Run "dotnet workload restore" to install a workload version.

Host: Version: 10.0.0-preview.5.25277.114 Architecture: x64 Commit: ddf39a1b46

.NET SDKs installed: 8.0.412 [C:\Program Files\dotnet\sdk] 9.0.302 [C:\Program Files\dotnet\sdk] 10.0.100-preview.5.25277.114 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 10.0.0-preview.5.25277.114 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 10.0.0-preview.5.25277.114 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 10.0.0-preview.5.25277.114 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: None

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

Visual Studio Code Extensions
Extension Author Version Folder Name
auto-close-tag formulahendry 0.5.15 formulahendry.auto-close-tag-0.5.15
change-case wmaurer 1.0.0 wmaurer.change-case-1.0.0
code-spell-checker streetsidesoftware 4.0.47 streetsidesoftware.code-spell-checker-4.0.47
copilot GitHub 1.342.0 github.copilot-1.342.0
copilot-chat GitHub 0.29.0 github.copilot-chat-0.29.0
csdevkit ms-dotnettools 1.30.44 ms-dotnettools.csdevkit-1.30.44-win32-x64
csharp ms-dotnettools 2.84.19 ms-dotnettools.csharp-2.84.19-win32-x64
docker docker 0.12.0 docker.docker-0.12.0-win32-x64
dotenv mikestead 1.0.1 mikestead.dotenv-1.0.1
EditorConfig EditorConfig 0.17.4 editorconfig.editorconfig-0.17.4
eml leighlondon 0.4.0 leighlondon.eml-0.4.0
hexeditor ms-vscode 1.11.1 ms-vscode.hexeditor-1.11.1
JavaScriptSnippets xabikos 1.8.0 xabikos.javascriptsnippets-1.8.0
markdown-mermaid bierner 1.28.0 bierner.markdown-mermaid-1.28.0
mermaid-markdown-syntax-highlighting bpruitt-goddard 1.7.4 bpruitt-goddard.mermaid-markdown-syntax-highlighting-1.7.4
msbuild-project-tools tintoy 0.6.6 tintoy.msbuild-project-tools-0.6.6
prettier-vscode esbenp 11.0.0 esbenp.prettier-vscode-11.0.0
remote-explorer ms-vscode 0.5.0 ms-vscode.remote-explorer-0.5.0
remote-ssh ms-vscode-remote 0.120.0 ms-vscode-remote.remote-ssh-0.120.0
remote-ssh-edit ms-vscode-remote 0.87.0 ms-vscode-remote.remote-ssh-edit-0.87.0
remote-wsl ms-vscode-remote 0.99.0 ms-vscode-remote.remote-wsl-0.99.0
render-crlf medo64 1.9.1 medo64.render-crlf-1.9.1
rest-client humao 0.25.1 humao.rest-client-0.25.1
t4-support zbecknell 0.7.0 zbecknell.t4-support-0.7.0
Theme-TomorrowKit ms-vscode 0.1.4 ms-vscode.theme-tomorrowkit-0.1.4
todo-tree Gruntfuggly 0.0.226 gruntfuggly.todo-tree-0.0.226
toggle-hidden adrianwilczynski 1.0.2 adrianwilczynski.toggle-hidden-1.0.2
trailing-spaces shardulm94 0.4.1 shardulm94.trailing-spaces-0.4.1
vscode-commons redhat 0.0.6 redhat.vscode-commons-0.0.6
vscode-containers ms-azuretools 2.0.3 ms-azuretools.vscode-containers-2.0.3
vscode-dotnet-runtime ms-dotnettools 2.3.6 ms-dotnettools.vscode-dotnet-runtime-2.3.6
vscode-github-actions github 0.27.2 github.vscode-github-actions-0.27.2
vscode-graphql-syntax GraphQL 1.3.8 graphql.vscode-graphql-syntax-1.3.8
vscode-highlight fabiospampinato 1.9.0 fabiospampinato.vscode-highlight-1.9.0
vscode-markdownlint DavidAnson 0.60.0 davidanson.vscode-markdownlint-0.60.0
vscode-sort-json richie5um2 1.20.0 richie5um2.vscode-sort-json-1.20.0
vscode-svg-previewer vitaliymaz 0.7.0 vitaliymaz.vscode-svg-previewer-0.7.0
vscode-yaml redhat 1.18.0 redhat.vscode-yaml-1.18.0

Extension version: 2.84.19 VS Code version: Code 1.102.0 (cb0c47c0cfaad0757385834bd89d410c78a856c0, 2025-07-09T22:10:34.600Z) OS version: Windows_NT x64 10.0.26100 Modes:

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i5-13600KF (20 x 3494)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 127.83GB (95.58GB free)
Process Argv --folder-uri file:///d%3A/*
Screen Reader no
VM 0%

glen-84 avatar Jul 13 '25 10:07 glen-84

I am experiencing the same issue, it started happening a couple days ago and it is a huge annoyance. Intellisense breaks down after a few minutes of use and I need to restart the VS code instance to keep working.

claudioalbanese avatar Jul 14 '25 05:07 claudioalbanese

Sorry that this is happening. We just put out prerelease v2.86.19 of the prerelease C# extension. It would be great to know if the issue is still occurring with that.

Off the cuff I am unsure why the analyzer runner would be trying to get diagnostics for a tree that is not part of the compilation.

RikkiGibson avatar Jul 16 '25 22:07 RikkiGibson

I have the same Problem with the same Version with VSCode 1.103.0-insider C# 2.84.19 Will test the prerelease version. - Unfortunately the message persists. Note I use a dev container.

FlorianInova avatar Jul 17 '25 09:07 FlorianInova

Still occurring with the prerelease version.

glen-84 avatar Jul 17 '25 17:07 glen-84

I'm going to try to pull down the indicated repo and see if I can at least reproduce locally.

@dibarbet This is one that might become easier to investigate with improvements to distributed logging.

RikkiGibson avatar Jul 28 '25 18:07 RikkiGibson

I cloned the GraphQL Platform repo, ran init.cmd, opened in vscode, and poked around at some of the C# files. I wasn't able to repro the problem straight away.

Is there any more info you can provide here, such as specific names of files that were opened/edited, specific commit you had checked out, etc.

I can try leaving the repo open for a while and inspect things a little later to see if that will help with a repro.

RikkiGibson avatar Jul 28 '25 19:07 RikkiGibson

It's not a specific commit. When it happens again I'll post the file name(s) here.

I often have Rider open at the same time – can that interfere in any way?

glen-84 avatar Jul 29 '25 11:07 glen-84

I often have Rider open at the same time – can that interfere in any way?

Possibly. C#+Dev Kit watches your project files, source files, and obj folders for changes, and will perform a design-time build based on certain changes to those files. (e.g. editing the .csproj.) Rider is likely to be doing a similar thing.

So, if both C# Dev Kit (Dev Kit is running it looks like?) and Rider are touching files in the same obj directory, they could be compelling each other to perform design time builds in a pattern they ordinarily wouldn't.

How that would lead to a syntax tree from the wrong compilation being used for some analysis is not clear, though.

RikkiGibson avatar Jul 29 '25 17:07 RikkiGibson

Same issue, lots of notifications popping up: Image

With both C# extension version: 2.84.19 and also with pre-release version: 2.87.26

Log
2025-08-04 14:09:51.269 [info] [Error - 14:09:51] [codeLens/resolve] [LSP] System.ArgumentException: SyntaxTree is not part of the compilation (Parameter 'syntaxTree')
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetSemanticModel(SyntaxTree syntaxTree, SemanticModelOptions options) in /_/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs:line 2547
   at Microsoft.CodeAnalysis.Diagnostics.SuppressMessageAttributeState.IsDiagnosticSuppressed(Diagnostic diagnostic, SuppressMessageInfo& info)
   at Microsoft.CodeAnalysis.Diagnostics.SuppressMessageAttributeState.ApplySourceSuppressions(Diagnostic diagnostic) in /_/src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.cs:line 120
   at Microsoft.CodeAnalysis.GeneratorDriver.FilterDiagnostics(Compilation compilation, ImmutableArray`1 generatorDiagnostics, DiagnosticBag driverDiagnostics, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/SourceGeneration/GeneratorDriver.cs:line 430
   at Microsoft.CodeAnalysis.GeneratorDriver.RunGeneratorsCore(Compilation compilation, DiagnosticBag diagnosticsBag, Func`2 generatorFilter, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/SourceGeneration/GeneratorDriver.cs:line 326
   at Microsoft.CodeAnalysis.SolutionCompilationState.RegularCompilationTracker.ComputeNewGeneratorInfoInCurrentProcessAsync(SolutionCompilationState compilationState, Compilation compilationWithoutGeneratedFiles, TextDocumentStates`1 oldGeneratedDocuments, GeneratorDriver generatorDriver, Compilation compilationWithStaleGeneratedTrees, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.RegularCompilationTracker_Generators.cs:line 268
   at Microsoft.CodeAnalysis.SolutionCompilationState.RegularCompilationTracker.AddExistingOrComputeNewGeneratorInfoAsync(CreationPolicy creationPolicy, SolutionCompilationState compilationState, Compilation compilationWithoutGeneratedFiles, CompilationTrackerGeneratorInfo generatorInfo, Compilation compilationWithStaleGeneratedTrees, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.RegularCompilationTracker_Generators.cs:line 66
   at Microsoft.CodeAnalysis.SolutionCompilationState.RegularCompilationTracker.<>c__DisplayClass25_0.<<GetOrBuildFinalStateAsync>g__FinalizeCompilationWorkerAsync|4>d.MoveNext() in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.RegularCompilationTracker.cs:line 583
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.SolutionCompilationState.RegularCompilationTracker.<>c__DisplayClass25_0.<<GetOrBuildFinalStateAsync>g__FinalizeCompilationAsync|3>d.MoveNext() in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.RegularCompilationTracker.cs:line 455
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.SolutionCompilationState.RegularCompilationTracker.<>c__DisplayClass25_0.<<GetOrBuildFinalStateAsync>g__BuildFinalStateAsync|0>d.MoveNext() in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.RegularCompilationTracker.cs:line 305
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.SolutionCompilationState.RegularCompilationTracker.GetOrBuildFinalStateAsync(SolutionCompilationState compilationState, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.RegularCompilationTracker.cs:line 267
   at Microsoft.CodeAnalysis.SolutionCompilationState.RegularCompilationTracker.GetCompilationSlowAsync(SolutionCompilationState compilationState, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.RegularCompilationTracker.cs:line 238
   at Microsoft.CodeAnalysis.Shared.Extensions.ProjectExtensions.GetRequiredCompilationAsync(Project project, CancellationToken cancellationToken) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/ProjectExtensions.cs:line 111
   at Microsoft.CodeAnalysis.Document.<>c__DisplayClass28_0.<<GetSemanticModelHelperAsync>g__GetSemanticModelWorkerAsync|0>d.MoveNext() in /_/src/Workspaces/Core/Portable/Workspace/Solution/Document.cs:line 351
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Document.GetSemanticModelHelperAsync(Boolean disableNullableAnalysis, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Workspace/Solution/Document.cs:line 331
   at Microsoft.CodeAnalysis.CodeLens.CodeLensReferencesService.FindAsync[T](Solution solution, DocumentId documentId, SyntaxNode syntaxNode, Func`2 onResults, Func`2 onCapped, Int32 searchCap, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/CodeLens/CodeLensReferencesService.cs:line 52
   at Microsoft.CodeAnalysis.CodeLens.CodeLensReferencesService.GetReferenceCountAsync(Solution solution, DocumentId documentId, SyntaxNode syntaxNode, Int32 maxSearchResults, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/CodeLens/CodeLensReferencesService.cs:line 92
   at Microsoft.CodeAnalysis.LanguageServer.Handler.CodeLens.CodeLensResolveHandler.HandleRequestAsync(CodeLens request, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/CodeLens/CodeLensResolveHandler.cs:line 67
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
2025-08-04 14:09:51.270 [info] [Error - 14:09:51] Request codeLens/resolve failed.

BramMusters avatar Aug 04 '25 12:08 BramMusters

I've confirmed that it's not Rider, as it continues to occur when Rider hasn't been opened.

glen-84 avatar Aug 31 '25 10:08 glen-84

@RikkiGibson Any updates here?

glen-84 avatar Oct 08 '25 13:10 glen-84

We have an integration test in WIP state #8470 which appeared to be triggering this issue. My hope is to revisit that test in the next couple of weeks and get to a root cause.

RikkiGibson avatar Oct 08 '25 16:10 RikkiGibson

The problem in https://github.com/dotnet/vscode-csharp/issues/8412#issuecomment-3150361111 may be resolved by dotnet/roslyn#80422. That PR should be included in the prerelease of the C# extension currently.

I'm now working on bringing those integration tests back up. Hopefully we will repro the problem in the issue description again, if it is still present.

RikkiGibson avatar Oct 28 '25 23:10 RikkiGibson