Microsoft.CodeAnalysis.LanguageServer client: Couldn't connect to server (Source: C# [Extension])
Asked Answered
A

4

7

OS: Ubuntu 22.04.3 VSCode: 1.83

Every time I open Visual Studio Code, an error pops up saying "Microsoft.CodeAnalysis.LanguageServer client: Couldn't connect to server (Source: C# [Extension])".

Intellisense does not work for C# either, and I am unsure if it has to do with this error.

The following is the output:

Using dotnet configured on PATH
Dotnet path: /usr/bin/snap
Activating C# + C# Dev Kit + C# IntelliCode...
waiting for named pipe information from server...
[stderr] error: unknown command "/home/alex/.vscode/extensions/ms-dotnettools.csharp-2.6.24-linux-x64/.roslyn/Microsoft.CodeAnalysis.LanguageServer.dll", see 'snap help'.
Language server process exited with 64
[Error - 10:30:55 AM] Microsoft.CodeAnalysis.LanguageServer client: couldn't create connection to server.

I don't know what is causing it. I have tried reinstalling VSCode and reinstalling my extensions. I have checked the filepath of the unknown command to see if the file was missing for some reason, but it is present.

Algol answered 18/10, 2023 at 15:45 Comment(1)
I have the same problem. I tried all tips in the other comments, uninstalled the extension, cleaned up the file system and installed again, checked paths, rebooted a couple of times. When I start with admin privileges everything is fine, but with regular account always raise the error and debugger doesn't show up.Bioecology
S
9

According to this issue on github.

You can try to delete the folder found in (command 'open extensions folder'). Then reinstall the C# extension.

Spectroscopy answered 19/10, 2023 at 8:29 Comment(1)
"the folder" which folder?Redbreast
I
6
rm -rf /Users/<YourName>/.vscode/extensions/ms-dotnettools*

Then close all instances of VS Code and reopen and reinstall C# Dev Kit

Indigence answered 13/2 at 17:40 Comment(1)
Just did it, but unfortunately Microsoft.CodeAnalysis.LanguageServer is still consuming 1GB of memory while idle.Smyth
C
4

In my case (OS: mac os x apple silicon) The settings for the C# extension had a wrong path for the "Dotnet Path" setting. It had added /dotnet in front of existing path somehow after the update.

The path with issue looked like this: /usr/local/share/dotnet/dotnet

what fixed the issue for me is to change that path to: /usr/local/share/dotnet

here is the example setting: example extension setting vacode on apple macbook m2

Chammy answered 14/5 at 16:45 Comment(2)
i want to do that to, but what's the setting to change the path ?Expectorate
@Expectorate i have added an example image for your reference, please let me know if it helps.Chammy
C
0

Try following dibarbet's instructions from this github issue. Namely:

Update dotnet.server.startTimeout in your vscode settings to something longer.

Reload the window.

If that doesn't work:

  1. Set the dotnet.server.trace configuration in vscode settings to Trace.

  2. Reload the window

  3. File a new bug report or perhaps leave a comment on the github issue above and attach the logs with the new log level. (Logs from the vscode output tab with C# selected there). Check if the the language server process is running after it times out (e.g. ps -ef | grep 'Microsoft.CodeAnalysis.LanguageServer.exe') Check if reverting to an older version of the extension fixes

Cyder answered 22/8 at 19:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.