vscode-csharp
vscode-csharp copied to clipboard
Compiler errors such as CS0246 are sticky (C# dev kit never sees updates from other files)
From vscode-dotnettools created by StephenCleary: microsoft/vscode-dotnettools#418
Type: Bug
Open a file and reference a type that doesn't exist yet. The extension correctly reports a Problem like CS0246. Create another file and add that type.
The CS0246 never clears (until VSCode is restarted). I can successfully compile but the extension never sees updates from other files.
Relevant info: I'm developing inside a Linux devcontainer running on Windows, and file change notifications are not passed through in this scenario.
Extension version: 0.4.5 VS Code version: Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:22:42.175Z) OS version: Windows_NT x64 10.0.19045 Modes: Remote OS version: Linux x64 5.10.102.1-microsoft-standard-WSL2
System Info
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off 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 video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
Load (avg) | undefined |
Memory (System) | 31.79GB (15.02GB free) |
Process Argv | --crash-reporter-id 51be58ac-bb42-4ba2-bb04-9b65817a6d47 |
Screen Reader | no |
VM | 0% |
Item | Value |
---|---|
Remote | Dev Container: Azure Developer CLI |
OS | Linux x64 5.10.102.1-microsoft-standard-WSL2 |
CPUs | Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592) |
Memory (System) | 24.88GB (21.09GB free) |
VM | 0% |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
vscaat:30438848
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vsccc:30803844
3biah626:30602489
f6dab269:30613381
showlangstatbar:30737416
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
gsofb:30804716
pythonnosmt12:30797651
pythonidxptcf:30805731
pythonnoceb:30805159
dsvsc013:30795093
dsvsc014:30804076
diffeditorv1:30812748
Same on windows (without wsl) + dotnet sdk 8.0.100-preview.6.23330.14
vscode-csharp extension - v2.0.413. and there is no error in C# / C# LSP trace logs
It looks like the C# extension will never work, at least we have the option to return to the omnisharp.
This issue is also reproduced on the latest version of C# extension v2.0.416 for Linux/Mac OS
Investigating. Sorry for the inconvenience here.
@StephenCleary @LuckyKang79 can you please confirm if the stale persistent errors you mentioned are in an open file OR a closed file? Additionally, are these coming from an explicit Build/Rebuild command or from intellisense while you type in VSCode?
I tried to reproduce the issue on the latest C#/C# DevKit extension and see that it only repros with closed files, and that is also if the background analysis scope for Compiler diagnostics is set to Open Files
. If switched to Full Solution
, we do get property diagnostic refresh in the Problems window.
@vchirikov From the screenshot you shared, your issue seems to be a different one, likely due to some design time build failure where references to corlib/System.Runtime are also not being resolved. Can you please file a separate issue with more details, and if possible a repro? Thanks!
@mavasani Regardless of whether the background analysis scope of compiler diagnostics is set to "Open File
" or "Full Solution
" For the Blazor server InAuth project/Blazor WASM project, we will encounter these two errors after opening the Program.cs
file
C# version: v2.0.416
VS Code version:1.81.1
Error:
The type or namespace name 'BlazorClient' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?)
[{
"resource": "/home/aapt/BlazorClient/Program.cs",
"owner": "_generated_diagnostic_collection_name_#2",
"code": {
"value": "CS0246",
"target": {
"$mid": 1,
"path": "/query/roslyn.query",
"scheme": "https",
"authority": "msdn.microsoft.com",
"query": "appId=roslyn&k=k(CS0246)"
}
},
"severity": 8,
"message": "The type or namespace name 'BlazorClient' could not be found (are you missing a using directive or an assembly reference?)",
"source": "Roslyn",
"startLineNumber": 3,
"startColumn": 7,
"endLineNumber": 3,
"endColumn": 19
}]
[{
"resource": "/home/aapt/BlazorClient/Program.cs",
"owner": "_generated_diagnostic_collection_name_#2",
"code": {
"value": "CS0246",
"target": {
"$mid": 1,
"path": "/query/roslyn.query",
"scheme": "https",
"authority": "msdn.microsoft.com",
"query": "appId=roslyn&k=k(CS0246)"
}
},
"severity": 8,
"message": "The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?)",
"source": "Roslyn",
"startLineNumber": 6,
"startColumn": 28,
"endLineNumber": 6,
"endColumn": 31
}]
Also I added Environment data details for your reference:
dotnet --info
output:.
NET SDK:
Version: 7.0.401
Commit: eb26aacfec
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/share/dotnet/sdk/7.0.401/
Host:
Version: 7.0.11
Architecture: x64
Commit: ecb34f85ec
.NET SDKs installed:
7.0.401 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.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
@vchirikov From the screenshot you shared, your issue seems to be a different one, likely due to some design time build failure where references to corlib/System.Runtime are also not being resolved. Can you please file a separate issue with more details, and if possible a repro? Thanks!
@mavasani, I created the issue https://github.com/dotnet/vscode-csharp/issues/6250 with trace logs
@StephenCleary @LuckyKang79 can you please confirm if the stale persistent errors you mentioned are in an open file OR a closed file? Additionally, are these coming from an explicit Build/Rebuild command or from intellisense while you type in VSCode?
I tried to reproduce the issue on the latest C#/C# DevKit extension and see that it only repros with closed files, and that is also if the background analysis scope for Compiler diagnostics is set to
Open Files
. If switched toFull Solution
, we do get property diagnostic refresh in the Problems window.
Thanks so much for solution, It works for me.