-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C# extension stopped working suddenly #7734
Comments
Update: basic compile info works for items outside of the current file. I.e. functionality such as |
@achobanov a couple questions
A short gif or screencap of exactly what is going wrong would be super helpful. |
Not sure if this is the same error but I'm getting very similar behaviour These errors pop up after opening a folder with a C# project: I'm only getting file / text-based completion, no semantic language-aware completion: Log from Output / C#
Edit: I'm on 1.95.1 so maybe the bug mentioned earlier could be my issue? |
Here's a video:https://github.com/user-attachments/assets/1b511a90-e423-45a8-8913-a009ecc0648f |
@achobanov thank you for the video, that and the trace logs you originally attached helped a lot! It appears to be an issue applying a C# code action when the code action returns edits inside a razor file. Instead of getting the top level razor file, we return edits in the virtual C# file. Note that this also applies to FAR/GTD when invoking from a C# file -> razor file.
|
@dibarbet Happy to help. I don't understand "Note that this also applies to FAR/GTD when invoking from a C# file -> razor file". Can you share a rough ETA on the fix? |
Thank you for helping with so much interaction and traces. We're evaluating solutions so I can't give an ETA, but I can tell you this helps push priorities. Long term we have a solution for this in a big architecture change that we are calling "cohosting" (if you see anything about that in the razor repo) but short term I'm going to see if we can find a tactical fix.
The general problem is how the razor compiler (which produces csharp files) communicates the content of those files to the csharp server across processes. You may be asking yourself why two processes? Well! That's what cohosting is going to solve :). Until then though the problem is that by design LSP messages that notify of content from an editor it's supposed to block other requests until that request is handled. Think of it like a user typing and the editor is informing of the changes because the file isn't saved to disk. You want everything to be up to date when asking for things like what semantic tokens are available, what completions should be happening, and what symbols are defined. The same problem applies with how we're communicating the generated files to the csharp server. So requests for FAR/GTD have to first know about the content before they can accurately determine the answer. If the communication of csharp files to the LSP server is blocking things it will slow down the system. Hopefully that's helpful. It's a bit of a late night rant from me to say: yes, we understand the problem. yes, we're working on it. I can't give an ETA but solving this is high on my to-do list. |
@ryzngard Thanks for the clarification. No worries I understand the situation. It's great to hear there is a fundamental solution planned. In the meantime I'll assume I can't rely on VS Code to fix stuff in razor files. However I've encountered other (on the surface similar issues) that are VS Code or razor related. Can I ask for directions on how and where to report those:
This is an initial feedback of trying to use VS Code as aa main c# editor for about 10 days now. I'd appreciate your feedback |
There's a few nuances to that. Do you mean the code action doesn't apply to C# files as well? We have a known issue for it not updating razor files dotnet/razor#6167
This actually was just recently fixed by dotnet/razor#11146 and will ship in VS 17.13 P2
Is this RZ10012 (I hope I got the number right) saying a component isn't found?
If it's the solution explorer can you file a separate bug? I don't know about the rename dialog being customized like it is in VS. I'm assuming that's a VS Code limitation because they own that UI and we implement the LSP contract.
Another issue to track this would be great :) |
I also realized I was combining #7582 with my response last night. It all kind of folds into the same problem space in my head but I realize they're two separate issues. |
I certainly thought so, but I cannot replicate it now, so I guess it was either temporary or I got it wrong, so scratch that one.
FML it cost me half a day of manual usings editing in my razor files the other day.. Anyway happy it's shipped.
Yes thats the one: Found markup element with unexpected name 'WithdrawForm'. If this is intended to be a component, add a @using directive for its namespace.Razor(RZ10012)
Just to clarify - it's not that I need to customize the visuals of the rename dialog. I think you can easily do it with an option in the extension, which when ON will rename the file along with the type name.
I'll need some time to setup the keybinds in order to report exactly what's going wrong with details. One further question - can you briefly explain or direct me to a good read on the topic if you know a good resource (I couldnt find one) regarding .razor roslyn analyzers? I'd like to enforce some code style and formatting rules, but standard analyzers don't seem to work. I've opened up a question here |
We definitely have had issues about this in the past and work on fixes. If you hit it again report another issue so we can get logs. Good information to include also is: Does it go away? Does it happen after it previously was working? Are they from a component in the same project, different project, or from a nuget package?
That's not a bad idea. Can you file an issue for this and I'll mark as a feature request? That way it can go onto the queue and be voted on etc so we know how to prioritize.
This isn't currently a scenario we've had a lot of requests for. Roslyn analyzers aren't intended to work because razor files are |
It happens every time I open the solution for a lot of components (maybe not all but quite a lot) and then it resolves itself. I'm guessing that's part of the loading process and doesn't warrant an issue? I'll report report the next sticky occurrence I get. |
If it's only at startup we're working on improving that. Tracking with #7582 and dotnet/razor#10600 . If it's sticky that's definitely not good and when logs would help. |
Type: Bug
Issue Description
Opening a new issue as instructed here: #7514 (comment)
Initially it seemed like only limited functionality (such as the quick fix actions) wasn't working, however it seems like its a lot deeper now:
Some stuff is working - for example if I hoven on a field, it shows me that's a readonly field of a certain type, although this could be VS code being clever, as it only works for members of the current class. Short story shorter - it's not working as expected at all.
Logs
I've set log level to trace.
C# log
vscode-c#-log.txt
C# LSP Trace Logs
vscode-c#-lsp-log.txt
Environment information
VSCode version: 1.93.1
C# Extension: 2.50.27
Using OmniSharp: false
Dotnet Information
.NET SDK: Version: 8.0.403 Commit: c64aa40a71 Workload version: 8.0.400-manifests.e0880c5d MSBuild version: 17.11.9+a69bbaaf5Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.403\
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
[android]
Installation Source: SDK 8.0.400, VS 17.10.35326.205, VS 17.11.35327.3
Manifest Version: 34.0.143/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.143\WorkloadManifest.json
Install Type: FileBased
[aspire]
Installation Source: SDK 8.0.400, VS 17.10.35326.205, VS 17.11.35327.3
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: FileBased
[ios]
Installation Source: SDK 8.0.400, VS 17.10.35326.205, VS 17.11.35327.3
Manifest Version: 18.0.8303/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\18.0.8303\WorkloadManifest.json
Install Type: FileBased
[maccatalyst]
Installation Source: SDK 8.0.400, VS 17.10.35326.205, VS 17.11.35327.3
Manifest Version: 18.0.8303/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\18.0.8303\WorkloadManifest.json
Install Type: FileBased
[maui-windows]
Installation Source: SDK 8.0.400, VS 17.10.35326.205, VS 17.11.35327.3
Manifest Version: 8.0.82/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.82\WorkloadManifest.json
Install Type: FileBased
Host:
Version: 8.0.10
Architecture: x64
Commit: 81cabf2857
.NET SDKs installed:
6.0.419 [C:\Program Files\dotnet\sdk]
7.0.410 [C:\Program Files\dotnet\sdk]
8.0.201 [C:\Program Files\dotnet\sdk]
8.0.302 [C:\Program Files\dotnet\sdk]
8.0.306 [C:\Program Files\dotnet\sdk]
8.0.403 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.27 [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.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.27 [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.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.27 [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.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.10 [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/download
Visual Studio Code Extensions
Extension version: 2.50.27
VS Code version: Cursor 0.42.4 (b1e87884330fc271d5eb589e368c35f14e76dec0, 2024-10-29T17:17:29.347Z)
OS version: Windows_NT x64 10.0.19045
Modes:
System Info
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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
extension-log-folder.zip
The text was updated successfully, but these errors were encountered: