Skip to content

Microsoft.CodeAnalysis.LanguageServer client: couldn't create connection to server #6276

@LukasMod

Description

@LukasMod

Type: Bug

Issue Description

Expected Behavior

C# works as expected, I have autocomplete and no errors from vsc language server.

Actual Behavior

After opening my first project with unity I had problems with autocomplete in vsc. I applied probably all solutions possible on SO. At first I just didn't have autocomplete but after various actions the current error appeared.
Currently I stopped where I get the above error and I don't know if it means error or missing path.

One attempt to get it working was by adding that PATH and DOTNET_ROOT in .zshrc and .bash_profile, but those lines aren't there anymore and the error still points to that, I'm wondering if it's the fault of some cache or maybe I'm misunderstanding the error.

I have reinstalled extensions and .NET SDK multiple times,
which dotnet
/usr/local/share/dotnet/dotnet
dotnet --list-sdks
7.0.307 [/usr/local/share/dotnet/sdk]

How to deal with the error:
Cannot find dotnet path 'export PATH=$PATH:$HOME/.dotnet export DOTNET_ROOT=$HOME/.dotnet/dotnet'

my .zshrc:

# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="dstufft"
plugins=(git)
source $ZSH/oh-my-zsh.sh

export PATH=/opt/homebrew/bin:$PATH
eval "$(rbenv init -)"


export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh

LANG=en_US.UTF-8

export PATH=$PATH:$HOME/.maestro/bin

# Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"

my .zprofile:

# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/zprofile.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zprofile.pre.zsh"
# Set PATH, MANPATH, etc., for Homebrew.
eval "$(/opt/homebrew/bin/brew shellenv)"


export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools

# Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/zprofile.post.zsh" ]] && builtin source "$HOME/.fig/shell/zprofile.post.zsh"

Logs

C# log

[Error - 07:06:15] Microsoft.CodeAnalysis.LanguageServer client: couldn't create connection to server. Error: Cannot find dotnet path 'export PATH=$PATH:$HOME/.dotnet export DOTNET_ROOT=$HOME/.dotnet/dotnet' at t.DotnetRuntimeExtensionResolver. (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1381739) at Generator.next () at /Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1380881 at new Promise () at r (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1380626) at t.DotnetRuntimeExtensionResolver.getHostExecutableInfo (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1381344) at I. (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1395879) at Generator.next () at /Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1387688 at new Promise () at r (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1387433) at I.startServer (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1395737) at I. (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1389004) at Generator.next () at /Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1387688 at new Promise () at r (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1387433) at /Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1388952 at s.createMessageTransports (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:2416078) at s.createConnection (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:2256140) at s.start (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:2246655) at I. (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1390802) at Generator.next () at /Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1387688 at new Promise () at r (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1387433) at I.start (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1388405) at /Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1406424 at Generator.next () at /Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1387688 at new Promise () at r (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1387433) at t.activateRoslynLanguageServer (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1402154) at /Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1421446 at Generator.next () at s (/Users/user1/.vscode/extensions/ms-dotnettools.csharp-2.0.436-darwin-arm64/dist/extension.js:2:1417003)

Environment information

VSCode version: 1.81.1
C# Extension: 2.0.436
Using OmniSharp: false

Dotnet Information Cannot find dotnet path 'export PATH=$PATH:$HOME/.dotnet export DOTNET_ROOT=$HOME/.dotnet/dotnet'
Visual Studio Code Extensions
Extension Author Version Folder Name
aws-toolkit-vscode amazonwebservices 1.87.0 amazonwebservices.aws-toolkit-vscode-1.87.0
code-spell-checker streetsidesoftware 2.20.5 streetsidesoftware.code-spell-checker-2.20.5
code-spell-checker-polish streetsidesoftware 2.1.0 streetsidesoftware.code-spell-checker-polish-2.1.0
color-highlight naumovs 2.5.0 naumovs.color-highlight-2.5.0
csdevkit ms-dotnettools 0.4.10 ms-dotnettools.csdevkit-0.4.10-darwin-arm64
csharp ms-dotnettools 2.0.436 ms-dotnettools.csharp-2.0.436-darwin-arm64
doxdocgen cschlosser 1.4.0 cschlosser.doxdocgen-1.4.0
env-cmd-file-syntax Nixon 0.3.0 nixon.env-cmd-file-syntax-0.3.0
es7-react-js-snippets dsznajder 4.4.3 dsznajder.es7-react-js-snippets-4.4.3
fig withfig 0.0.7 withfig.fig-0.0.7
githistory donjayamanne 0.6.20 donjayamanne.githistory-0.6.20
highlight-matching-tag vincaslt 0.11.0 vincaslt.highlight-matching-tag-0.11.0
material-icon-theme PKief 4.30.1 pkief.material-icon-theme-4.30.1
material-palenight-theme whizkydee 2.0.3 whizkydee.material-palenight-theme-2.0.3
prettier-vscode esbenp 10.1.0 esbenp.prettier-vscode-10.1.0
pretty-ts-errors yoavbls 0.5.1 yoavbls.pretty-ts-errors-0.5.1
quicktype quicktype 12.0.46 quicktype.quicktype-12.0.46
syntax-project-pbxproj mariomatheu 0.1.3 mariomatheu.syntax-project-pbxproj-0.1.3
vscode-dotnet-runtime ms-dotnettools 1.7.2 ms-dotnettools.vscode-dotnet-runtime-1.7.2
vscode-eslint dbaeumer 2.4.2 dbaeumer.vscode-eslint-2.4.2
vscode-expo-tools expo 1.0.7 expo.vscode-expo-tools-1.0.7
vscode-exports-autocomplete capaj 0.5.4 capaj.vscode-exports-autocomplete-0.5.4
vscode-graphql-execution GraphQL 0.2.4 graphql.vscode-graphql-execution-0.2.4
vscode-graphql-syntax GraphQL 1.2.2 graphql.vscode-graphql-syntax-1.2.2
vscode-todo-highlight wayou 1.0.5 wayou.vscode-todo-highlight-1.0.5
vscodeintellicode-csharp ms-dotnettools 0.1.26 ms-dotnettools.vscodeintellicode-csharp-0.1.26-darwin-arm64
vstuc visualstudiotoolsforunity 0.9.0 visualstudiotoolsforunity.vstuc-0.9.0

Extension version: 2.0.436
VS Code version: Code 1.81.1 (Universal) (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:20:33.924Z)
OS version: Darwin arm64 22.3.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (8 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 3, 3, 3
Memory (System) 16.00GB (0.04GB free)
Process Argv --crash-reporter-id 2b38129f-006f-4224-9a5d-f40e99ad1ce3
Screen Reader yes
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vstes516:30244333
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30792226
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vsccc:30803844
2e4cg342:30602488
89544117:30613380
a9j8j154:30646983
showlangstatbar:30737416
a2ce3375:30757347
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxptcf:30805731
pythonnoceb:30805159
synctok:30821570
dsvsc013:30795093
dsvsc014:30804076
diffeditorv1:30821571
dsvsc015:30823817

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions