dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.88k stars 676 forks source link

Go to Implementation and similar funtionality failing silently when project doesn't build #7801

Open achobanov opened 6 days ago

achobanov commented 6 days ago

Type: Feature Request

Issue Description

I'm not sure what ambrela term to use, please forgive my ignorance, but I'll call it static analysis - i.e. context about types, their implementation, references and diagnostics and quick fix actions. All of that sometimes stops working. My guess is that happens when I switch a branch and some binaries aren't yet built, or there is a compile-tyme error, but I'm not sure. The issue is fixed usually by attempt to build or restart of the IDE or both

Steps to Reproduce

Not sure, but you can try to change branches with conflicting changes - i.e. changes on the same files in both branches.

Expected Behavior

This should either not happen or at least the IDE should provide relevant feedback - i.e. build error or at least a suggestion to try rebuild.

Actual Behavior

Simply says no "Implementations found" or similar

Logs

exthost.zip

C# log

Post the output from Output-->C# here

C# LSP Trace Logs

Post the output from Output-->C# LSP Trace Logs here. Requires the `C#` output window log level to be set to `Trace`

Environment information

VSCode version: 1.93.1 C# Extension: 2.55.29 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+a69bbaaf5 Runtime 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.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.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.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.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.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.403 [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 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 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.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 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.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|Author|Version|Folder Name| |---|---|---|---| |auto-close-tag|formulahendry|0.5.15|formulahendry.auto-close-tag-0.5.15| |csdevkit|ms-dotnettools|1.13.9|ms-dotnettools.csdevkit-1.13.9-win32-x64| |csharp|ms-dotnettools|2.55.29|ms-dotnettools.csharp-2.55.29-win32-x64| |markdown-preview-github-styles|bierner|2.1.0|bierner.markdown-preview-github-styles-2.1.0| |razor-switcher|LennartKleymann|1.0.0|lennartkleymann.razor-switcher-1.0.0| |vscode-dotnet-runtime|ms-dotnettools|2.2.2|ms-dotnettools.vscode-dotnet-runtime-2.2.2| |vscode-github-actions|github|0.27.0|github.vscode-github-actions-0.27.0| |vscode-icons|vscode-icons-team|12.9.0|vscode-icons-team.vscode-icons-12.9.0| |vscode-todo-highlight|wayou|1.0.5|wayou.vscode-todo-highlight-1.0.5| |vscode-yaml|redhat|1.15.0|redhat.vscode-yaml-1.15.0| |vscodeintellicode-csharp|ms-dotnettools|2.2.3|ms-dotnettools.vscodeintellicode-csharp-2.2.3-win32-x64|;

Additional notes

I've reported similar issues limited only to razor file analysis: I've reported similar issue, limited to razor components only: https://github.com/dotnet/vscode-csharp/issues/7798

Extension version: 2.55.29 VS Code version: Cursor 0.42.5 (001668006cc714afd397f4ef0d52862f5a095530, 2024-11-14T00:33:36.512Z) OS version: Windows_NT x64 10.0.19045 Modes:

dibarbet commented 3 days ago

A couple questions

  1. Is the reference you're navigating to used cross language (e.g. in C# and in a Razor file)?
  2. Can you confirm if the server sees the file in the correct project? I highly recommend pinning the active file context item in the language status bar: Image
  3. Can you enable trace logging as described here - https://github.com/dotnet/vscode-csharp/blob/main/SUPPORT.md#collecting-general-logs to capture the trace logs when the navigation fails?
  4. Any other details on what actions were being taken before the navigation failed? Does it always occur on branch switch? Does it eventually work?
achobanov commented 3 days ago
  1. It could be cross language, but c# only usage breaks as well
  2. Cannot confirm right now, but this has happened before and file was in the correct project
  3. I thought I did that, will do again
  4. Happened couple of time when I was navigating away from a branch with a lot of changes to another branch with fewer changes (both branched of develop). Doesn't happen every time. Regarding if eventually works - effectively no, at least not in a few minutes.