dotnet / vscode-csharp

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

Server process seems to be restarted when unsupported files are in a C# project #7681

Open emmenlau opened 1 month ago

emmenlau commented 1 month ago

Type: Bug

Issue Description

I see in the C# extension log the following errors:

[Error - 2:19:09 PM] [LanguageServerHost] System.InvalidOperationException: Unsupported extension '.i' and LSP language id ''
   at Microsoft.CodeAnalysis.LanguageServer.LanguageInfoProvider.GetLanguageInformation(String documentPath, String lspLanguageId) in /_/src/LanguageServer/Protocol/LanguageInfoProvider.cs:line 63
   at Microsoft.CodeAnalysis.LanguageServer.RoslynLanguageServer.GetLanguageForRequest(String methodName, Object serializedParameters) in /_/src/LanguageServer/Protocol/RoslynLanguageServer.cs:line 169
   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.ProcessQueueAsync()
[Info  - 2:19:09 PM] Error processing queue, shutting down
[Error - 2:19:09 PM] Workspace diagnostic pull failed.
Canceled: Canceled
    at a.handleFailedRequest (/home/memmenlauer/.vscode/extensions/ms-dotnettools.csharp-2.50.27-linux-x64/dist/extension.js:2:2125365)
    at a.handleFailedRequest (/home/memmenlauer/.vscode/extensions/ms-dotnettools.csharp-2.50.27-linux-x64/dist/extension.js:2:1163022)
    at /home/memmenlauer/.vscode/extensions/ms-dotnettools.csharp-2.50.27-linux-x64/dist/extension.js:2:2162775
    at runNextTicks (node:internal/process/task_queues:60:5)
    at processImmediate (node:internal/timers:454:9)
    at g.pullWorkspaceAsync (/home/memmenlauer/.vscode/extensions/ms-dotnettools.csharp-2.50.27-linux-x64/dist/extension.js:2:2160083)
[Error - 2:19:09 PM] Workspace diagnostic pull failed.
Canceled: Canceled
    at a.handleFailedRequest (/home/memmenlauer/.vscode/extensions/ms-dotnettools.csharp-2.50.27-linux-x64/dist/extension.js:2:2125365)
    at a.handleFailedRequest (/home/memmenlauer/.vscode/extensions/ms-dotnettools.csharp-2.50.27-linux-x64/dist/extension.js:2:1163022)
    at /home/memmenlauer/.vscode/extensions/ms-dotnettools.csharp-2.50.27-linux-x64/dist/extension.js:2:2162775
    at g.pullWorkspaceAsync (/home/memmenlauer/.vscode/extensions/ms-dotnettools.csharp-2.50.27-linux-x64/dist/extension.js:2:2160083)
[Info  - 2:19:09 PM] Connection to server got closed. Server will restart.
true
Using dotnet configured on PATH
Dotnet path: /usr/lib/dotnet/dotnet
Activating C# + C# Dev Kit...
waiting for named pipe information from server...
[stdout] {"pipeName":"/tmp/b6a0054e.sock"}
received named pipe information from server
attempting to connect client to server...
client has connected to server

Steps to Reproduce

I think the error is coming because I have a C++ / C# mixed project, that uses SWIG bindings in *.i files. Could this be the *.i files that are mentioned in the error message?

Expected Behavior

The server should not need to restart.

Actual Behavior

The server seems to restart.

Logs

C# log

See above.

C# LSP Trace Logs

Extension vscode.bat does not contribute csharpExtensionLoadPaths
Extension vscode.clojure does not contribute csharpExtensionLoadPaths
Extension vscode.coffeescript does not contribute csharpExtensionLoadPaths
Extension vscode.configuration-editing does not contribute csharpExtensionLoadPaths
Extension vscode.cpp does not contribute csharpExtensionLoadPaths
Extension vscode.csharp does not contribute csharpExtensionLoadPaths
Extension vscode.css does not contribute csharpExtensionLoadPaths
Extension vscode.css-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.dart does not contribute csharpExtensionLoadPaths
Extension vscode.debug-auto-launch does not contribute csharpExtensionLoadPaths
Extension vscode.debug-server-ready does not contribute csharpExtensionLoadPaths
Extension vscode.diff does not contribute csharpExtensionLoadPaths
Extension vscode.docker does not contribute csharpExtensionLoadPaths
Extension vscode.emmet does not contribute csharpExtensionLoadPaths
Extension vscode.extension-editing does not contribute csharpExtensionLoadPaths
Extension vscode.fsharp does not contribute csharpExtensionLoadPaths
Extension vscode.git does not contribute csharpExtensionLoadPaths
Extension vscode.git-base does not contribute csharpExtensionLoadPaths
Extension vscode.github does not contribute csharpExtensionLoadPaths
Extension vscode.github-authentication does not contribute csharpExtensionLoadPaths
Extension vscode.go does not contribute csharpExtensionLoadPaths
Extension vscode.groovy does not contribute csharpExtensionLoadPaths
Extension vscode.grunt does not contribute csharpExtensionLoadPaths
Extension vscode.gulp does not contribute csharpExtensionLoadPaths
Extension vscode.handlebars does not contribute csharpExtensionLoadPaths
Extension vscode.hlsl does not contribute csharpExtensionLoadPaths
Extension vscode.html does not contribute csharpExtensionLoadPaths
Extension vscode.html-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.ini does not contribute csharpExtensionLoadPaths
Extension vscode.ipynb does not contribute csharpExtensionLoadPaths
Extension vscode.jake does not contribute csharpExtensionLoadPaths
Extension vscode.java does not contribute csharpExtensionLoadPaths
Extension vscode.javascript does not contribute csharpExtensionLoadPaths
Extension vscode.json does not contribute csharpExtensionLoadPaths
Extension vscode.json-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.julia does not contribute csharpExtensionLoadPaths
Extension vscode.latex does not contribute csharpExtensionLoadPaths
Extension vscode.less does not contribute csharpExtensionLoadPaths
Extension vscode.log does not contribute csharpExtensionLoadPaths
Extension vscode.lua does not contribute csharpExtensionLoadPaths
Extension vscode.make does not contribute csharpExtensionLoadPaths
Extension vscode.markdown does not contribute csharpExtensionLoadPaths
Extension vscode.markdown-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.markdown-math does not contribute csharpExtensionLoadPaths
Extension vscode.media-preview does not contribute csharpExtensionLoadPaths
Extension vscode.merge-conflict does not contribute csharpExtensionLoadPaths
Extension vscode.microsoft-authentication does not contribute csharpExtensionLoadPaths
Extension ms-vscode.js-debug does not contribute csharpExtensionLoadPaths
Extension ms-vscode.js-debug-companion does not contribute csharpExtensionLoadPaths
Extension ms-vscode.vscode-js-profile-table does not contribute csharpExtensionLoadPaths
Extension vscode.builtin-notebook-renderers does not contribute csharpExtensionLoadPaths
Extension vscode.npm does not contribute csharpExtensionLoadPaths
Extension vscode.objective-c does not contribute csharpExtensionLoadPaths
Extension vscode.perl does not contribute csharpExtensionLoadPaths
Extension vscode.php does not contribute csharpExtensionLoadPaths
Extension vscode.php-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.powershell does not contribute csharpExtensionLoadPaths
Extension vscode.pug does not contribute csharpExtensionLoadPaths
Extension vscode.python does not contribute csharpExtensionLoadPaths
Extension vscode.r does not contribute csharpExtensionLoadPaths
Extension vscode.razor does not contribute csharpExtensionLoadPaths
Extension vscode.references-view does not contribute csharpExtensionLoadPaths
Extension vscode.restructuredtext does not contribute csharpExtensionLoadPaths
Extension vscode.ruby does not contribute csharpExtensionLoadPaths
Extension vscode.rust does not contribute csharpExtensionLoadPaths
Extension vscode.scss does not contribute csharpExtensionLoadPaths
Extension vscode.search-result does not contribute csharpExtensionLoadPaths
Extension vscode.shaderlab does not contribute csharpExtensionLoadPaths
Extension vscode.shellscript does not contribute csharpExtensionLoadPaths
Extension vscode.simple-browser does not contribute csharpExtensionLoadPaths
Extension vscode.sql does not contribute csharpExtensionLoadPaths
Extension vscode.swift does not contribute csharpExtensionLoadPaths
Extension vscode.theme-abyss does not contribute csharpExtensionLoadPaths
Extension vscode.theme-defaults does not contribute csharpExtensionLoadPaths
Extension vscode.theme-kimbie-dark does not contribute csharpExtensionLoadPaths
Extension vscode.theme-monokai does not contribute csharpExtensionLoadPaths
Extension vscode.theme-monokai-dimmed does not contribute csharpExtensionLoadPaths
Extension vscode.theme-quietlight does not contribute csharpExtensionLoadPaths
Extension vscode.theme-red does not contribute csharpExtensionLoadPaths
Extension vscode.vscode-theme-seti does not contribute csharpExtensionLoadPaths
Extension vscode.theme-solarized-dark does not contribute csharpExtensionLoadPaths
Extension vscode.theme-solarized-light does not contribute csharpExtensionLoadPaths
Extension vscode.theme-tomorrow-night-blue does not contribute csharpExtensionLoadPaths
Extension vscode.tunnel-forwarding does not contribute csharpExtensionLoadPaths
Extension vscode.typescript does not contribute csharpExtensionLoadPaths
Extension vscode.typescript-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.vb does not contribute csharpExtensionLoadPaths
Extension vscode.xml does not contribute csharpExtensionLoadPaths
Extension vscode.yaml does not contribute csharpExtensionLoadPaths
Extension alefragnani.project-manager does not contribute csharpExtensionLoadPaths
Extension Delgan.qml-format does not contribute csharpExtensionLoadPaths
Extension DotJoshJohnson.xml does not contribute csharpExtensionLoadPaths
Extension eamodio.gitlens does not contribute csharpExtensionLoadPaths
Extension felgo.felgo does not contribute csharpExtensionLoadPaths
Extension foxundermoon.shell-format does not contribute csharpExtensionLoadPaths
Extension GitHub.copilot does not contribute csharpExtensionLoadPaths
Extension GitHub.copilot-chat does not contribute csharpExtensionLoadPaths
Extension GitHub.vscode-pull-request-github does not contribute csharpExtensionLoadPaths
Extension GitLab.gitlab-workflow does not contribute csharpExtensionLoadPaths
Extension hbenl.vscode-test-explorer does not contribute csharpExtensionLoadPaths
Extension IBM.output-colorizer does not contribute csharpExtensionLoadPaths
Extension jeff-hykin.better-cpp-syntax does not contribute csharpExtensionLoadPaths
Extension knv.qt6renderer does not contribute csharpExtensionLoadPaths
Extension llvm-vs-code-extensions.vscode-clangd does not contribute csharpExtensionLoadPaths
Extension matepek.vscode-catch2-test-adapter does not contribute csharpExtensionLoadPaths
Extension ms-azuretools.vscode-docker does not contribute csharpExtensionLoadPaths
Extension ms-dotnettools.csdevkit does not contribute csharpExtensionLoadPaths
Extension ms-dotnettools.csharp does not contribute csharpExtensionLoadPaths
Extension ms-dotnettools.vscode-dotnet-runtime does not contribute csharpExtensionLoadPaths
Extension ms-python.debugpy does not contribute csharpExtensionLoadPaths
Extension ms-python.python does not contribute csharpExtensionLoadPaths
Extension ms-python.vscode-pylance does not contribute csharpExtensionLoadPaths
Extension ms-toolsai.jupyter-keymap does not contribute csharpExtensionLoadPaths
Extension ms-vscode-remote.remote-containers does not contribute csharpExtensionLoadPaths
Extension ms-vscode-remote.remote-ssh does not contribute csharpExtensionLoadPaths
Extension ms-vscode-remote.remote-ssh-edit does not contribute csharpExtensionLoadPaths
Extension ms-vscode.cmake-tools does not contribute csharpExtensionLoadPaths
Extension ms-vscode.cpptools does not contribute csharpExtensionLoadPaths
Extension ms-vscode.hexeditor does not contribute csharpExtensionLoadPaths
Extension ms-vscode.powershell does not contribute csharpExtensionLoadPaths
Extension ms-vscode.remote-explorer does not contribute csharpExtensionLoadPaths
Extension ms-vscode.test-adapter-converter does not contribute csharpExtensionLoadPaths
Extension redhat.vscode-yaml does not contribute csharpExtensionLoadPaths
Extension stkb.rewrap does not contribute csharpExtensionLoadPaths
Extension streetsidesoftware.code-spell-checker does not contribute csharpExtensionLoadPaths
Extension streetsidesoftware.code-spell-checker-german does not contribute csharpExtensionLoadPaths
Extension timonwong.shellcheck does not contribute csharpExtensionLoadPaths
Extension vadimcn.vscode-lldb does not contribute csharpExtensionLoadPaths
Extension yzhang.markdown-all-in-one does not contribute csharpExtensionLoadPaths
Extension zhangciwu.swig-tpl does not contribute csharpExtensionLoadPaths

Environment information

VSCode version: 1.94.2 C# Extension: 2.50.27 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 8.0.403 Commit: c64aa40a71 Workload version: 8.0.400-manifests.18f19b92 MSBuild version: 17.11.9+a69bbaaf5 Runtime Environment: OS Name: ubuntu OS Version: 24.04 OS Platform: Linux RID: linux-x64 Base Path: /usr/lib/dotnet/sdk/8.0.403/ .NET workloads installed: Configured to use loose manifests when installing new manifests. There are no installed workloads to display. Host: Version: 8.0.10 Architecture: x64 Commit: 81cabf2857 .NET SDKs installed: 8.0.403 [/usr/lib/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 8.0.10 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.10 [/usr/lib/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
Visual Studio Code Extensions |Extension|Author|Version|Folder Name| |---|---|---|---| |better-cpp-syntax|jeff-hykin|1.27.1|jeff-hykin.better-cpp-syntax-1.27.1| |cmake-tools|ms-vscode|1.19.52|ms-vscode.cmake-tools-1.19.52| |code-spell-checker|streetsidesoftware|3.0.1|streetsidesoftware.code-spell-checker-3.0.1| |code-spell-checker-german|streetsidesoftware|2.3.2|streetsidesoftware.code-spell-checker-german-2.3.2| |copilot|GitHub|1.241.0|github.copilot-1.241.0| |copilot-chat|GitHub|0.21.2|github.copilot-chat-0.21.2| |cpptools|ms-vscode|1.22.10|ms-vscode.cpptools-1.22.10-linux-x64| |csdevkit|ms-dotnettools|1.11.14|ms-dotnettools.csdevkit-1.11.14-linux-x64| |csharp|ms-dotnettools|2.50.27|ms-dotnettools.csharp-2.50.27-linux-x64| |debugpy|ms-python|2024.12.0|ms-python.debugpy-2024.12.0-linux-x64| |felgo|felgo|2.0.1|felgo.felgo-2.0.1| |gitlab-workflow|GitLab|5.16.0|gitlab.gitlab-workflow-5.16.0| |gitlens|eamodio|15.6.2|eamodio.gitlens-15.6.2| |hexeditor|ms-vscode|1.10.0|ms-vscode.hexeditor-1.10.0| |jupyter-keymap|ms-toolsai|1.1.2|ms-toolsai.jupyter-keymap-1.1.2| |markdown-all-in-one|yzhang|3.6.2|yzhang.markdown-all-in-one-3.6.2| |output-colorizer|IBM|0.1.2|ibm.output-colorizer-0.1.2| |powershell|ms-vscode|2024.2.2|ms-vscode.powershell-2024.2.2| |project-manager|alefragnani|12.8.0|alefragnani.project-manager-12.8.0| |python|ms-python|2024.16.1|ms-python.python-2024.16.1-linux-x64| |qml-format|Delgan|1.0.4|delgan.qml-format-1.0.4| |qt6renderer|knv|1.0.0|knv.qt6renderer-1.0.0| |remote-containers|ms-vscode-remote|0.388.0|ms-vscode-remote.remote-containers-0.388.0| |remote-explorer|ms-vscode|0.4.3|ms-vscode.remote-explorer-0.4.3| |remote-ssh|ms-vscode-remote|0.115.0|ms-vscode-remote.remote-ssh-0.115.0| |remote-ssh-edit|ms-vscode-remote|0.87.0|ms-vscode-remote.remote-ssh-edit-0.87.0| |rewrap|stkb|1.16.3|stkb.rewrap-1.16.3| |shell-format|foxundermoon|7.2.5|foxundermoon.shell-format-7.2.5| |shellcheck|timonwong|0.37.1|timonwong.shellcheck-0.37.1-linux-x64| |swig-tpl|zhangciwu|0.0.6|zhangciwu.swig-tpl-0.0.6| |test-adapter-converter|ms-vscode|0.2.0|ms-vscode.test-adapter-converter-0.2.0| |vscode-catch2-test-adapter|matepek|4.12.2|matepek.vscode-catch2-test-adapter-4.12.2| |vscode-clangd|llvm-vs-code-extensions|0.1.29|llvm-vs-code-extensions.vscode-clangd-0.1.29| |vscode-docker|ms-azuretools|1.29.3|ms-azuretools.vscode-docker-1.29.3| |vscode-dotnet-runtime|ms-dotnettools|2.2.0|ms-dotnettools.vscode-dotnet-runtime-2.2.0| |vscode-lldb|vadimcn|1.11.0|vadimcn.vscode-lldb-1.11.0-linux-x64| |vscode-pull-request-github|GitHub|0.98.0|github.vscode-pull-request-github-0.98.0| |vscode-pylance|ms-python|2024.10.1|ms-python.vscode-pylance-2024.10.1| |vscode-test-explorer|hbenl|2.22.1|hbenl.vscode-test-explorer-2.22.1| |vscode-yaml|redhat|1.15.0|redhat.vscode-yaml-1.15.0| |xml|DotJoshJohnson|2.5.1|dotjoshjohnson.xml-2.5.1|;

Extension version: 2.50.27 VS Code version: Code 1.94.2 (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z) OS version: Linux x64 6.8.0-47-generic Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 PRO 4750U with Radeon Graphics (16 x 1330)| |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
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off| |Load (avg)|1, 1, 1| |Memory (System)|30.58GB (20.65GB free)| |Process Argv|BDAImageAcquire.code-workspace| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|ubuntu| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|ubuntu| |XDG_SESSION_TYPE|x11|
dibarbet commented 1 month ago

@emmenlau what language does VSCode say the .i files are? In the bottom right bar: Image

Additionally, we fixed an issue with similar symptoms in 2.53.17 (prerelease), would be curious if that helps your issue

Otherwise, if you're able to collect the 'C# LSP Trace Logs' with dotnet.server.trace set to `Trace (see https://github.com/dotnet/vscode-csharp/blob/main/SUPPORT.md#collecting-general-logs) it should tell us exactly which file is causing the problem.