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
221 stars 10 forks source link

[BUG] 20k+ bogus reported errors ping-ponging in- and out of existence #1371

Open rjgotten opened 1 month ago

rjgotten commented 1 month ago

Describe the Issue

Opening a C# solution containing ~80 projects, configured with

"dotnet.backgroundAnalysis.analyzerDiagnosticsScope": "fullSolution",
"dotnet.backgroundAnalysis.compilerDiagnosticsScope": "fullSolution"

results in the errors panel ping-ponging like crazy between the normal and accurate diagnostics warnings, and an additional 20k+ of phantom non-existent errors wrt classes or namespaces not existing. This includes errors wrt classes and namespaces defined in the solution itself, as well as predefined classes such as System.Int32, Task or Nullable.

Some of the affected files are all *.cshtml__virtual.cs files related to MVC Razor. They contribute ~500 errors. These appear to be more persistent in that they don't blink in and out of existence as frequently.

In addition, the VSCode Extensions Host output log contains an unending deluge of the same error, repeating every ~100ms :

2024-08-16 11:22:02.180 [error] Error: Illegal argument: line must be non-negative
    at d (c:\Users\r.otten\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:10:1029)
    at new u (c:\Users\r.otten\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:151:4879)
    at f (c:\Users\r.otten\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:151:6395)
    at C (c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csharp-2.39.29-win32-x64\dist\extension.js:2:2229754)
    at w (c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csharp-2.39.29-win32-x64\dist\extension.js:2:2228739)
    at c (c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csharp-2.39.29-win32-x64\dist\extension.js:2:2273282)
    at t.map (c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csharp-2.39.29-win32-x64\dist\extension.js:2:2273368)
    at Object.asDiagnostics (c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csharp-2.39.29-win32-x64\dist\extension.js:2:2241065)
    at S.workDiagnosticQueue (c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csharp-2.39.29-win32-x64\dist\extension.js:2:2123269)
    at Immediate.<anonymous> (c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csharp-2.39.29-win32-x64\dist\extension.js:2:2122935)
    at process.processImmediate (node:internal/timers:478:21)

Additionally, csdevkit occasionally spews out an illegal write after end as well:

2024-08-16 11:45:53.583 [error] Error: write after end
    at _write (node:internal/streams/writable:481:11)
    at Writable.write (node:internal/streams/writable:502:10)
    at c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csdevkit-1.9.55-win32-x64\dist\extension.js:2:162016
    at new Promise (<anonymous>)
    at a.write (c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csdevkit-1.9.55-win32-x64\dist\extension.js:2:161934)
    at i.doWrite (c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csdevkit-1.9.55-win32-x64\dist\extension.js:2:800400)
    at c:\Users\r.otten\.vscode\extensions\ms-dotnettools.csdevkit-1.9.55-win32-x64\dist\extension.js:2:800295

No idea if related.

Steps To Reproduce

No idea what actually exactly triggers this. VSCode gives me nothing to go off of that might hint to how to build an isolated reproducing case.

At one point things simply broke in a massive way for the solution in question. (Which works perfectly fine in VS 2022, btw.)

Expected Behavior

Environment Information

(PS: Don't use placeholders to show the 'environment information' template's list of items, please. I had to use F12 debug tools to copy and paste out the template, because typing a single character wipes everything else...)

AArnott commented 4 weeks ago

@arkalyanms This isn't my area. This sounds like something the C# or nuget teams should investigate.

rjgotten commented 3 weeks ago

This appears like it might be a duplicate of dotnet/razor#10505 as well as be partly related to #1328

rjgotten commented 3 weeks ago

Question: is there a way to just completely disable the VSCode Razor support while retaining the nominal C# support? Like a killswitch just for the razor support? (This would be SO much easier if it were just a proper bundled VSCode extension on its own, that would just have its own entry in the extensions list to disable. Hint hint.)

My interest in managing .cshtml files via VSCode is basically zero - because the support that's there is, frankly, abysmally broken. The syntax highlighter has tons of issues, the automatic code reformatting makes a mess of things; it causes a spray of nonsense errors all the time - including non-suppressable popup dialogs; etc. It's just not ready for prime time yet, despite efforts put in sofar.

So, I've already taken to just using VS 2022 when I need to work on those.