dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.87k stars 674 forks source link

New language server cannot start without a solution file #6013

Closed dandev486 closed 1 year ago

dandev486 commented 1 year ago

Type: Bug

Issue Description

When creating a project without a solution file, the new language server seems unable to start.

In time, not sure if it is related somehow, but from the automatically collected information when opening the issue through the issue reporter, it seems that the extension is unable to identify an SDK, which can be seen in this report at .NET SDKs installed: No SDKs were found., when I have two of them (and the extension itself also performed an additional installation within the extension folder - even though it seems to be just the runtime).

$ which dotnet
/usr/bin/dotnet
$ dotnet --list-sdks
6.0.412 [/usr/share/dotnet/sdk]
7.0.306 [/usr/share/dotnet/sdk]

The only active configuration for the new extension version, was to disable telemetry.

"dotnetAcquisitionExtension.enableTelemetry": false,

Steps to Reproduce

In a terminal, create a new console application and then open it with Visual Studio Code, with the C# Extension installed.

dotnet new console --name Project --output .
code .

Expected Behavior

Language server starts and provides features such as intellisense, refactoring, etc.

Actual Behavior

Language server freezes at startup.

Logs

C# log

Dotnet path: /home/dandev486/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.9/dotnet
Activating C# standalone...
info: LanguageServerHost[0]
      Starting server...

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.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 akamud.vscode-theme-onedark does not contribute csharpExtensionLoadPaths
Extension akamud.vscode-theme-onelight does not contribute csharpExtensionLoadPaths
Extension EditorConfig.EditorConfig does not contribute csharpExtensionLoadPaths
Extension ms-azuretools.vscode-docker 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.python does not contribute csharpExtensionLoadPaths
Extension ms-vscode.cpptools does not contribute csharpExtensionLoadPaths

Environment information

VSCode version: 1.80.2 C# Extension: 2.0.320 Using OmniSharp: false

Dotnet Information Host: Version: 7.0.9 Architecture: x64 Commit: 8e9a17b221 .NET SDKs installed: No SDKs were found. .NET runtimes installed: Microsoft.NETCore.App 7.0.9 [/home/dandev486/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.9/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| |---|---|---|---| |cpptools|ms-vscode|1.16.3|ms-vscode.cpptools-1.16.3-linux-x64| |csharp|ms-dotnettools|2.0.320|ms-dotnettools.csharp-2.0.320-linux-x64| |EditorConfig|EditorConfig|0.16.4|editorconfig.editorconfig-0.16.4| |python|ms-python|2023.12.0|ms-python.python-2023.12.0| |vscode-docker|ms-azuretools|1.26.0|ms-azuretools.vscode-docker-1.26.0| |vscode-dotnet-runtime|ms-dotnettools|1.6.0|ms-dotnettools.vscode-dotnet-runtime-1.6.0| |vscode-theme-onedark|akamud|2.3.0|akamud.vscode-theme-onedark-2.3.0| |vscode-theme-onelight|akamud|2.3.0|akamud.vscode-theme-onelight-2.3.0|;

Extension version: 2.0.320 VS Code version: Code 1.80.2 (2ccd690cbff1569e4a83d7c43d45101f817401dc, 2023-07-27T20:41:52.615Z) OS version: Linux x64 6.1.0-10-amd64 Modes:

dibarbet commented 1 year ago

Duplicate of https://github.com/dotnet/vscode-csharp/issues/5722

Until the above is resolved, I would recommend setting the dotnet.server.useOmnisharp flag which will switch back to the old behavior.

Wollbobaggins commented 1 year ago

I had a similar issue which I just found a solution that I wrote about here. Hope it helps! 🤞