Open jtsom opened 3 weeks ago
Downgrading from preview version (2.24.10), to release version (2.23.17) eliminates the errors.
Update. Release version IS showing this error:
mainThreadExtensionService.ts:82 Error: Illegal argument: line must be non-negative
at d (c:\Users\jtsombakos\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:10:1029)
at new u (c:\Users\jtsombakos\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:151:4879)
at new f (c:\Users\jtsombakos\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:151:6395)
at C (c:\Users\jtsombakos\.vscode\extensions\ms-dotnettools.csharp-2.33.17-win32-x64\dist\extension.js:2:2262526)
at w (c:\Users\jtsombakos\.vscode\extensions\ms-dotnettools.csharp-2.33.17-win32-x64\dist\extension.js:2:2261511)
at c (c:\Users\jtsombakos\.vscode\extensions\ms-dotnettools.csharp-2.33.17-win32-x64\dist\extension.js:2:2306054)
at t.map (c:\Users\jtsombakos\.vscode\extensions\ms-dotnettools.csharp-2.33.17-win32-x64\dist\extension.js:2:2306140)
at Object.asDiagnostics (c:\Users\jtsombakos\.vscode\extensions\ms-dotnettools.csharp-2.33.17-win32-x64\dist\extension.js:2:2273837)
at S.workDiagnosticQueue (c:\Users\jtsombakos\.vscode\extensions\ms-dotnettools.csharp-2.33.17-win32-x64\dist\extension.js:2:2156041)
at Immediate.<anonymous> (c:\Users\jtsombakos\.vscode\extensions\ms-dotnettools.csharp-2.33.17-win32-x64\dist\extension.js:2:2155707)
at process.processImmediate (node:internal/timers:478:21)
Unsure if this is causing incorrect errors in a stock .NET Aspire template project:
That error does NOT show when the project is opened in Visual Studio (and also did not show in a previous recent version of the extension)
This problem goes away reverting to version 2.31.19, reappears with version 2.33.17
Original error first appears in version 2.33.13
@jtsom I've tried out the scenario (aspire app in 2.33.17) and I haven't been able to reproduce the issue - my console doesn't have those errors and is relatively clean, doesn't seem to be much from the C# extension (expected)
A couple questions:
thanks!
This is with the stock Aspire app, and using version 2.33.17
and 2.32.14 (the last version that does not show the errors)
and 2.33..13 (first 2.33 version) - shows errors in console, but not error in code
I wonder if it's something specific to the Aspire project? Here is a relativly simple .Net 8 API project, that does not show the errors in the console. This is with the latest (prerelease) version 2.35.15
Opening the Aspire app causes the errors to appear, switching back to the API app, doesn't show errors.
FWIW - Disabling the C# dev kit also made the error not appear. with latest pre-release version
Opening another .Net web api solution, containing several projects, with the latest preview version, DID show all of the "Error: Illegal argument: line must be non-negative" errors - starting with one from the C# dev kit.
As soon as those showed up in the console (after all the projects loaded), there were now 600+ errors in the error list, showing errors of the type "System.Void not defined" - basically an error on every line. Those errors are definitely causing problems with error reporting.
Aha, I was able to get the illegal argument, line must be non-negative error today on a different machine (same Aspire project though).
Error: Illegal argument: line must be non-negative
at d (c:\Users\dabarbet\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:10:1029)
at new u (c:\Users\dabarbet\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:151:4879)
at new f (c:\Users\dabarbet\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:151:6395)
at C (c:\Users\dabarbet\.vscode\extensions\ms-dotnettools.csharp-2.34.10-win32-x64\dist\extension.js:2:2262527)
at w (c:\Users\dabarbet\.vscode\extensions\ms-dotnettools.csharp-2.34.10-win32-x64\dist\extension.js:2:2261512)
at c (c:\Users\dabarbet\.vscode\extensions\ms-dotnettools.csharp-2.34.10-win32-x64\dist\extension.js:2:2306055)
at Object.t.map (c:\Users\dabarbet\.vscode\extensions\ms-dotnettools.csharp-2.34.10-win32-x64\dist\extension.js:2:2306141)
at Object.asDiagnostics (c:\Users\dabarbet\.vscode\extensions\ms-dotnettools.csharp-2.34.10-win32-x64\dist\extension.js:2:2273838)
at S.workDiagnosticQueue (c:\Users\dabarbet\.vscode\extensions\ms-dotnettools.csharp-2.34.10-win32-x64\dist\extension.js:2:2156042)
at Immediate.<anonymous> (c:\Users\dabarbet\.vscode\extensions\ms-dotnettools.csharp-2.34.10-win32-x64\dist\extension.js:2:2155708)
at processImmediate (node:internal/timers:478:21)
taking a look...
Looks like there are two possible places where this exception is getting thrown, but they only occur for Razor files.
stack trace: Error: Illegal argument: line must be non-negative
at d (c:\Users\dabarbet\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:10:1029)
at new u (c:\Users\dabarbet\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:151:4879)
at new f (c:\Users\dabarbet\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:151:6395)
at asRange (c:\Users\dabarbet\source\repos\vscode-csharp\node_modules\vscode-languageclient\lib\common\protocolConverter.js:140:1)
at asDiagnostic (c:\Users\dabarbet\source\repos\vscode-csharp\node_modules\vscode-languageclient\lib\common\protocolConverter.js:70:1)
at convertBatch (c:\Users\dabarbet\source\repos\vscode-csharp\node_modules\vscode-languageclient\lib\common\utils\async.js:193:1)
at Object.map (c:\Users\dabarbet\source\repos\vscode-csharp\node_modules\vscode-languageclient\lib\common\utils\async.js:202:1)
at Object.asDiagnostics (c:\Users\dabarbet\source\repos\vscode-csharp\node_modules\vscode-languageclient\lib\common\protocolConverter.js:60:1)
at LanguageClient.workDiagnosticQueue (c:\Users\dabarbet\source\repos\vscode-csharp\node_modules\vscode-languageclient\lib\common\client.js:1089:1)
at Immediate.<anonymous> (c:\Users\dabarbet\source\repos\vscode-csharp\node_modules\vscode-languageclient\lib\common\client.js:1074:80)
at processImmediate (node:internal/timers:478:21)
at process.callbackTrampoline (node:internal/async_hooks:130:17)
I caught this one under the debugger
Transferring this issue to the Razor side (fyi @ryzngard, @davidwengier )
(@dibarbet) FYI Doing some testing, I found that the first version to show this problem is 2.33.17. That version is using a Preview version of Razor 9:
Bump Razor to 9.0.0-preview.24281.3
I don't think that's a coincidence.
For clarity, "Preview" here is just due to how Razor does package versioning. We don't ship any public packages to NuGet so we never "finalize" the version. Consider that engineering debt in naming alone and not an indication of the expected quality.
For a fun history dive, the version up until after https://github.com/dotnet/vscode-csharp/pull/7225 still said version 7.0.0-preview.<build identifier>
.
Well, my point is, that up until that version (2.33.17) was using a version of Razor < 9 (preview or not). Once the extension was built against V9 of Razor, that is when the problems started.
Understood, and thanks for reporting :). I just wanted to clarify on the naming because it is indeed confusing.
Definitely don't read too much into the version number. All of the Razor code in the C# extension, regardless of version, is built from the main branch in this repo. There aren't any external Razor dependencies we're bringing in that get major changes, that are hidden from view or anything like that. In fact the entire bump from v7 to v9 can be seen in this PR here: https://github.com/dotnet/razor/pull/10320/files#diff-1ea18ff65faa2ae6fed570b83747086d0317f5e4bc325064f6c14319a9c4ff67R16
Why was there no v8? Essentially because we forgot. We tried to go to v8, to keep things lined up neatly, but something broke deep inside VS, and we had to go back to v7.
For the .NET runtime, there are a bunch of smart people who think very carefully about versioning strategies, and naming of packages etc. For the Razor IDE team, we're just half a dozen people in a trenchcoat pretending to know what we're doing 😁
It's not so much the naming or the version number, I just noticed that in the release notes for the version of the C# extension, where all of these console errors and incorrect reporting of "errors" in the code happened, (2.13.17) has this change: https://github.com/dotnet/roslyn/pull/73817, with this commit https://github.com/dotnet/roslyn/pull/73817/commits/6a1688a578231dc3cb316e112ed5d1631e158b26
This tells me that the C# extension is using the .Net 9 code, and that is where the problem stems from.
So, it seems, something in the Razor 9.0.0-preview.24281.3 is causing errors in the C# extension.
thanks. Just trying to help get this fixed, as I have to revert the C# extension to 2.33.13 in order to get proper functionality.
Just updated to the latest C# extension (2.36.19), hoping it would eliminate the errors, but still happening
The "rejected promise not handled" are new this time around.
Well, I'm not sure what's going on now. I'm now seeing these errors back to the "good" version I was using (2.33.17). Went to an even older version (2.31.19) and still seeing the errors. This is causing all sorts of intellisense errors and mis-marked errors. FYI C# Dev Kit is at the current version (1.8.10)
Just tried the latest version of the C# extension (2.37.26) and the errors still persist. This causes all sorts of code errors to appear and disappear in .razor files
Makes using this extension and VSCode almost impossible - trying to chase down false errors.
I can confirm that it is still broken :-(. Please fix.
Type: Bug
Issue Description
C# Extension is filing the error console with exception messages.
Steps to Reproduce
Launch VS Code with a .Net project. Look in Developer Console.
Expected Behavior
No Errors
Actual Behavior
Lots of errors.
Logs
C# log
C# LSP Trace Logs
Environment information
VSCode version: 1.90.0 C# Extension: 2.34.10 Using OmniSharp: false
Dotnet Information
.NET SDK: Version: 8.0.301 Commit: 1a0e9c0300 Workload version: 8.0.300-manifests.6cb9d875 MSBuild version: 17.10.4+10fbfbf2e Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.301\ .NET workloads installed: [aspire] Installation Source: VS 17.10.35004.147, VS 17.11.35005.142 Manifest Version: 8.0.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0\WorkloadManifest.json Install Type: Msi Host: Version: 8.0.6 Architecture: x64 Commit: 3b8b000a0e .NET SDKs installed: 3.1.426 [C:\Program Files\dotnet\sdk] 5.0.408 [C:\Program Files\dotnet\sdk] 6.0.131 [C:\Program Files\dotnet\sdk] 6.0.321 [C:\Program Files\dotnet\sdk] 6.0.423 [C:\Program Files\dotnet\sdk] 7.0.120 [C:\Program Files\dotnet\sdk] 7.0.317 [C:\Program Files\dotnet\sdk] 7.0.410 [C:\Program Files\dotnet\sdk] 8.0.106 [C:\Program Files\dotnet\sdk] 8.0.206 [C:\Program Files\dotnet\sdk] 8.0.300 [C:\Program Files\dotnet\sdk] 8.0.301 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/downloadVisual Studio Code Extensions
|Extension|Author|Version|Folder Name| |---|---|---|---| |csdevkit|ms-dotnettools|1.8.2|ms-dotnettools.csdevkit-1.8.2-win32-x64| |csharp|ms-dotnettools|2.34.10|ms-dotnettools.csharp-2.34.10-win32-x64| |dotnet-maui|ms-dotnettools|1.0.6|ms-dotnettools.dotnet-maui-1.0.6-win32-x64| |hexeditor|ms-vscode|1.10.0|ms-vscode.hexeditor-1.10.0| |hl7tools|RobHolme|2.0.6|robholme.hl7tools-2.0.6| |kanagawa|qufiwefefwoyn|1.5.1|qufiwefefwoyn.kanagawa-1.5.1| |live-server|ms-vscode|0.4.13|ms-vscode.live-server-0.4.13| |markdown-all-in-one|yzhang|3.6.2|yzhang.markdown-all-in-one-3.6.2| |material-icon-theme|PKief|5.4.1|pkief.material-icon-theme-5.4.1| |night-owl|sdras|2.0.1|sdras.night-owl-2.0.1| |quicktype|quicktype|23.0.170|quicktype.quicktype-23.0.170| |rainbow-csv|mechatroner|3.12.0|mechatroner.rainbow-csv-3.12.0| |remote-wsl|ms-vscode-remote|0.88.2|ms-vscode-remote.remote-wsl-0.88.2| |rest-client|humao|0.25.1|humao.rest-client-0.25.1| |seeb|hmseeb|1.1.3|hmseeb.seeb-1.1.3| |vscode-dotnet-runtime|ms-dotnettools|2.0.6|ms-dotnettools.vscode-dotnet-runtime-2.0.6| |vscode-thunder-client|rangav|2.24.11|rangav.vscode-thunder-client-2.24.11| |vscodeintellicode-csharp|ms-dotnettools|2.1.11|ms-dotnettools.vscodeintellicode-csharp-2.1.11-win32-x64| |winteriscoming|johnpapa|1.4.4|johnpapa.winteriscoming-1.4.4| |xml|DotJoshJohnson|2.5.1|dotjoshjohnson.xml-2.5.1|;Extension version: 2.34.10 VS Code version: Code 1.90.0 (89de5a8d4d6205e5b11647eb6a74844ca23d2573, 2024-06-04T19:33:54.889Z) OS version: Windows_NT x64 10.0.22631 Modes:
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz (6 x 3000)| |GPU Status|2d_canvas: enabledcanvas_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| |Load (avg)|undefined| |Memory (System)|31.78GB (14.60GB free)| |Process Argv|--crash-reporter-id a079dcaa-039a-4dfb-8683-7ec01accca06| |Screen Reader|no| |VM|0%|
A/B Experiments
``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vstes627:30244334 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 vscaat:30438848 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 chatpanelc:31048052 dsvsc021:30996838 g316j359:31013175 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 pythonprt:31056678 dwnewjupyter:31046869 2f103344:31071589 ```