vscode-csharp
vscode-csharp copied to clipboard
Error with project files not finding objects or razor tags
Type: Bug
When opening files, whether .cs or .razor, the file gets a lot of red error lines and says it cannot find the object even though they are part of the project. If I go through and open every file, then the red error lines go away.
Extension version: 2.0.1 VS Code version: Code 1.85.2 (Universal) (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:32.531Z) OS version: Darwin arm64 22.5.0 Modes:
System Info
Item | Value |
---|---|
CPUs | Apple M1 Pro (10 x 24) |
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 video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
Load (avg) | 2, 2, 2 |
Memory (System) | 16.00GB (2.72GB free) |
Process Argv | --crash-reporter-id c0c8aad0-cf61-4da4-9ae7-38e376327f4a |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30951796
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
dsvsc019b:30953937
3ef8e399:30949928
Can you provide some more information?
- C# extension version and if you're using devkit
- the logs from the 'C#' output window
- some of the exact error messages you're seeing (screenshots are always useful)
[A screen shot of a computer Description automatically generated]
[A screenshot of a computer Description automatically generated]
[A screenshot of a computer Description automatically generated]
When I click on each file in the project, these error and warning squiggly lines go away, and the red project file names change to white. As I click through the project files, I get more and more of these squiggly lines, until I click through all of the files then they go away.
C# extension version: v2.15.30 C# devkit version: v1.3.10 IntelliCode for C# devkit version: v0.1.26
I don’t know where the logs are. There isn’t anything in the output tab.
From: David Barbet @.> Date: Wednesday, February 7, 2024 at 3:38 PM To: dotnet/vscode-csharp @.> Cc: Craig Godfrey @.>, Author @.> Subject: Re: [dotnet/vscode-csharp] Error with project files not finding objects or razor tags (Issue #6852) You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification
Can you provide some more information?
- C# extension version and if you're using devkit
- the logs from the 'C#' output window
- some of the exact error messages you're seeing (screenshots are always useful)
— Reply to this email directly, view it on GitHubhttps://github.com/dotnet/vscode-csharp/issues/6852#issuecomment-1932980873, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AENSQSHLEBWPOOGNBLL7BITYSPX35AVCNFSM6AAAAABC2QRQ2OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZSHE4DAOBXGM. You are receiving this because you authored the thread.Message ID: @.***>
Also, this only happens when I reopen the project, or if I open the project in visual studios then go back to vscode.
From: Craig Godfrey @.> Date: Wednesday, February 7, 2024 at 3:50 PM To: dotnet/vscode-csharp @.>, dotnet/vscode-csharp @.> Cc: Author @.> Subject: Re: [dotnet/vscode-csharp] Error with project files not finding objects or razor tags (Issue #6852) [A screen shot of a computer Description automatically generated]
[A screenshot of a computer Description automatically generated]
[A screenshot of a computer Description automatically generated]
When I click on each file in the project, these error and warning squiggly lines go away, and the red project file names change to white. As I click through the project files, I get more and more of these squiggly lines, until I click through all of the files then they go away.
C# extension version: v2.15.30 C# devkit version: v1.3.10 IntelliCode for C# devkit version: v0.1.26
I don’t know where the logs are. There isn’t anything in the output tab.
From: David Barbet @.> Date: Wednesday, February 7, 2024 at 3:38 PM To: dotnet/vscode-csharp @.> Cc: Craig Godfrey @.>, Author @.> Subject: Re: [dotnet/vscode-csharp] Error with project files not finding objects or razor tags (Issue #6852) You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification
Can you provide some more information?
- C# extension version and if you're using devkit
- the logs from the 'C#' output window
- some of the exact error messages you're seeing (screenshots are always useful)
— Reply to this email directly, view it on GitHubhttps://github.com/dotnet/vscode-csharp/issues/6852#issuecomment-1932980873, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AENSQSHLEBWPOOGNBLL7BITYSPX35AVCNFSM6AAAAABC2QRQ2OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZSHE4DAOBXGM. You are receiving this because you authored the thread.Message ID: @.***>
@davidwengier - any known problems with re-using incorrect build assets (or mismatch in build assets) between VS and vscode for Razor files?
Been a few reports recently it seems, like https://github.com/dotnet/vscode-csharp/issues/6921 and https://github.com/dotnet/vscode-csharp/issues/4580#issuecomment-1912001583, where maybe our closed file stuff has changed. We could easily be broken by a change to Roslyn here too, so might not be something we're aware of. Will put this in triage.
I also opened my project with Visual Studio one time and since then the issue persists. Tried clean, rebuild, etc. But even deleting and cloning again doesn't fix it.
When opening it in the WSL it works perfectly fine.
Update: When cloning on another Windows system the issue appears again. Also I encountered the issue one time in WSL, but here it resolved after reloading vs code, while in Windows I haven't found a way to resolve it by now.
Hi!
I had downgraded C# extension from v2.22.3 to v2.18.16, seems to be working now. I had similar issues but only for .razor files and in Program.cs. Current extension list: C#: v2.18.16 C# Dev Kit: v1.4.29
I will post update it starts reproducing again.
Program.cs showed one errror for App.razor, it did not recognized the generated class
I've fixed this issue by adding code behind and partial class for App.razor
public partial class App : ComponentBase
{
}
I have this error too. Any update on this? @davidwengier