microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
234 stars 13 forks source link

Editor shows errors but build succeeds #476

Open lukewis opened 1 year ago

lukewis commented 1 year ago

Type: Bug

I recently uninstalled and re-installed VSCode due to issues with the C# DevKit extension. It would complain that a type was not found even though "dotnet build" succeeds. After re-installing VSCode and the C# DevKit extension, I'm experiencing the same behavior.

C# DevKit is the only extension installed. Closing and re-opening VSCode resolves the issue (at least temporarily), though I've seen this behavior several times today. Typically while refactoring.

Extension version: 0.4.10 VS Code version: Code 1.81.1 (Universal) (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:20:33.924Z) OS version: Darwin x64 22.6.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz (6 x 3000)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|2, 2, 2| |Memory (System)|32.00GB (0.08GB free)| |Process Argv|--crash-reporter-id 06db76d3-4d1e-451d-a4d1-cbc00dad1b8c| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vslsvsres303:30308271 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 pythonvs932:30410667 vsclangdf:30486550 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 vscccc:30803845 282f8724:30602487 f6dab269:30613381 2i9eh265:30646982 showlangstatbar:30737416 0bi6i642:30823812 a2ce3375:30757347 pythonfmttext:30731395 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 pythonnosmt12:30797651 pythonidxpt:30805730 pythonnoceb:30805159 dsvsc013:30795093 dsvsc014:30804076 diffeditorv2:30821572 ```
phil-allen-msft commented 1 year ago

We're sorry you are running into this. In order to help us diagnose this, are the files involved in this Razor related files (.razor and .cshtml)?

lukewis commented 1 year ago

Hello! No, the files are plain *.cs files

github-actions[bot] commented 8 months ago

This issue has been marked as stale after 14 days of inactivity. @[ @ @], could you please take a look?

ryzngard commented 3 months ago

Moving to roslyn. This looks like an old issue. @lukewis are you still having problems? We've made a lot of fixes since last year.

lukewis commented 3 months ago

@ryzngard - I do still see this issue, yes. I will admit that it's difficult to reproduce. I probably see something like this once or twice a week now. If there are logs or diagnostic information I could collect when it does happen, let me know and, I'll try to grab those next time.

github-actions[bot] commented 3 months ago

@ryzngard, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.

ryzngard commented 3 months ago

@lukewis if you can enable verbose logs for roslyn/razor with the following settings. Then when you hit the logs in Output > C# and Output > Razor Log will give us more information.

    "razor.server.trace": "Trace",
    "dotnet.server.trace": "Trace"
JoeRobich commented 1 month ago

@lukewis Did your solution use WPF XAML?

lukewis commented 1 month ago

@JoeRobich - nope. Mine is a plain console application. I've started seeing it again recently. Will try to capture some logs soon.

github-actions[bot] commented 1 month ago

@ryzngard, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.

lukewis commented 1 month ago

@ryzngard - Unfortunately I don't have a repo I can share for reproduction (this happens intermittently and I haven't been able to pinpoint steps to reproduce), but I captured this stack trace today (although I just realized that I forgot to enable trace logging). I changed that setting, and next time it happens I'll try to provide a more detailed trace.

[Error - 10:45:36 AM] [LanguageServerHost] System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'start')
   at Microsoft.CodeAnalysis.CSharp.SyntaxTreeDiagnosticEnumerator.MoveNext()
   at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree.EnumerateDiagnostics(GreenNode node, Int32 position)+MoveNext() in /_/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs:line 802
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.FilterDiagnosticsByLocation(IEnumerable`1 diagnostics, SyntaxTree tree, Nullable`1 filterSpanWithinTree)+MoveNext() in /_/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs:line 3275
   at Microsoft.CodeAnalysis.DiagnosticBag.AddRange(IEnumerable`1 diagnostics) in /_/src/Compilers/Core/Portable/Diagnostic/DiagnosticBag.cs:line 140
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForSyntaxTree(CompilationStage stage, SyntaxTree syntaxTree, Nullable`1 filterSpanWithinTree, Boolean includeEarlierStages, CancellationToken cancellationToken) in /_/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs:line 3301
   at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDiagnostics(Nullable`1 span, CancellationToken cancellationToken) in /_/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs:line 137
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetCompilationEventsForSingleFileAnalysis(Compilation compilation, AnalysisScope analysisScope, ImmutableArray`1 additionalFiles, Boolean hasAnyActionsRequiringCompilationEvents, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs:line 1017
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.ComputeAnalyzerDiagnosticsAsync(AnalysisScope analysisScope, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs:line 767
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalysisResultCoreAsync(SemanticModel model, Nullable`1 filterSpan, ImmutableArray`1 analyzers, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs:line 654
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzers compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 356
   at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzers compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, Project project, DiagnosticAnalyzerInfoCache analyzerInfoCache, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Diagnostics/Extensions.cs:line 323
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeInProcAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzers compilationWithAnalyzers, RemoteHostClient client, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs:line 125
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.<>c__DisplayClass8_0.<<AnalyzeAsync>g__AnalyzeCoreAsync|0>d.MoveNext() in /_/src/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs:line 86
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Diagnostics.InProcOrRemoteHostAnalyzerRunner.AnalyzeAsync(DocumentAnalysisScope documentAnalysisScope, Project project, CompilationWithAnalyzers compilationWithAnalyzers, Boolean isExplicit, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs:line 71
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.GetAnalysisResultAsync(DocumentAnalysisScope analysisScope, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/DocumentAnalysisExecutor.cs:line 179
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.GetSemanticDiagnosticsAsync(DiagnosticAnalyzer analyzer, Boolean isCompilerAnalyzer, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/DocumentAnalysisExecutor.cs:line 282
   at Microsoft.CodeAnalysis.Diagnostics.DocumentAnalysisExecutor.ComputeDiagnosticsAsync(DiagnosticAnalyzer analyzer, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/DocumentAnalysisExecutor.cs:line 146
   at Microsoft.CodeAnalysis.Diagnostics.EngineV2.DiagnosticIncrementalAnalyzer.LatestDiagnosticsForSpanGetter.ComputeDocumentDiagnosticsForAnalyzerCoreAsync(DiagnosticAnalyzer analyzer, DocumentAnalysisExecutor executor, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 523
   at Microsoft.CodeAnalysis.Diagnostics.EngineV2.DiagnosticIncrementalAnalyzer.LatestDiagnosticsForSpanGetter.ComputeDocumentDiagnosticsCoreAsync(DocumentAnalysisExecutor executor, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 509
   at Microsoft.CodeAnalysis.Diagnostics.EngineV2.DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.ComputeDiagnosticsAsync(DocumentAnalysisExecutor executor, ImmutableArray`1 analyzersWithState, VersionStamp version, Func`4 computeAnalyzerDiagnosticsAsync, Func`3 computeDiagnosticsNonIncrementallyAsync, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs:line 69
   at Microsoft.CodeAnalysis.Diagnostics.EngineV2.DiagnosticIncrementalAnalyzer.LatestDiagnosticsForSpanGetter.ComputeDocumentDiagnosticsAsync(ImmutableArray`1 analyzersWithState, AnalysisKind kind, Nullable`1 span, ArrayBuilder`1 builder, Boolean incrementalAnalysis, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 388
   at Microsoft.CodeAnalysis.Diagnostics.EngineV2.DiagnosticIncrementalAnalyzer.LatestDiagnosticsForSpanGetter.GetAsync(ArrayBuilder`1 list, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 250
   at Microsoft.CodeAnalysis.Diagnostics.EngineV2.DiagnosticIncrementalAnalyzer.GetDiagnosticsForSpanAsync(TextDocument document, Nullable`1 range, Func`2 shouldIncludeDiagnostic, Boolean includeSuppressedDiagnostics, Boolean includeCompilerDiagnostics, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKinds, Boolean isExplicit, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs:line 41
   at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService.GetDiagnosticsForSpanAsync(TextDocument document, Nullable`1 range, Func`2 shouldIncludeDiagnostic, Boolean includeCompilerDiagnostics, Boolean includeSuppressedDiagnostics, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKinds, Boolean isExplicit, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Features/Diagnostics/DiagnosticAnalyzerService.cs:line 95
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.DocumentDiagnosticSource.GetDiagnosticsAsync(RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/DocumentDiagnosticSource.cs:line 31
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.ComputeAndReportCurrentDiagnosticsAsync(RequestContext context, IDiagnosticSource diagnosticSource, BufferedProgress`1 progress, String resultId, ClientCapabilities clientCapabilities, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs:line 285
   at Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.AbstractPullDiagnosticHandler`3.HandleRequestAsync(TDiagnosticsParams diagnosticsParams, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs:line 174
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
arunchndr commented 1 month ago

@dibarbet would you take a look and move to Roslyn as appropriate?