Skip to content

.NET SDK not found if installed via Snap and Snap aliases used #3077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rmunn opened this issue May 20, 2019 · 5 comments
Closed

.NET SDK not found if installed via Snap and Snap aliases used #3077

rmunn opened this issue May 20, 2019 · 5 comments

Comments

@rmunn
Copy link

rmunn commented May 20, 2019

Issue Description

If the .NET SDK has been installed via Snap (sudo snap install dotnet-sdk) on Ubuntu 18.04, and a Snap alias has been created with sudo snap alias dotnet-sdk.dotnet dotnet as recommended in https://github.com/dotnet/core-setup/issues/4230#issuecomment-398841315, then OmniSharp can't find the .NET SDK because dotnet --info fails with a SIGABRT when run from inside VS Code. Interestingly, dotnet --info works just fine when run from the command line.

Workaround: If instead of creating a Snap alias, I set my PATH to include /snap/dotnet-sdk/current somewhere before /snap/bin, then the dotnet --info command works and OmniSharp can find the .NET SDK as it should.

If I enable core dumps in Ubuntu, I can get a stack trace from the core dump. Unfortunately, the Snap package for dotnet-sdk does not appear to include debugging symbols so the stack trace isn't very useful, but I've included it in the Logs section below anyway.

Steps to Reproduce

  1. Run Ubuntu 18.04
  2. sudo snap install dotnet-sdk --classic
  3. sudo snap install code --classic
  4. In VS Code, install the C# Extension

Expected Behavior

OmniSharp runs dotnet --info and finds the .NET SDK correctly.

Actual Behavior

.NET SDK is not found because dotnet --info exists with a SIGABRT.

Logs

OmniSharp log

(empty)

C# log

Installing C# dependencies... Platform: linux, x86_64, name=ubuntu, version=18.04

Downloading package 'OmniSharp for Linux (x64)' (43145 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package 'OmniSharp for Linux (x64)'

Downloading package '.NET Core Debugger (linux / x64)' (64083 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package '.NET Core Debugger (linux / x64)'

Downloading package 'Razor Language Server (Linux / x64)' (58328 KB).................... Done!
Installing package 'Razor Language Server (Linux / x64)'

Finished

Failed to spawn 'dotnet --info'

Stack trace

Stack trace generated by Gdb
#0  0x00007f888b78fe97 in raise () from /snap/dotnet-sdk/38/lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f888b791801 in abort () from /snap/dotnet-sdk/38/lib/x86_64-linux-gnu/libc.so.6
#2  0x00007f888ae8fa23 in PROCAbort () from /snap/dotnet-sdk/38/shared/Microsoft.NETCore.App/2.2.5/libcoreclr.so
#3  0x00007f888ae8e81b in PROCEndProcess(void*, unsigned int, int) () from /snap/dotnet-sdk/38/shared/Microsoft.NETCore.App/2.2.5/libcoreclr.so
#4  0x00007f888abf7938 in UnwindManagedExceptionPass1(PAL_SEHException&, _CONTEXT*) () from /snap/dotnet-sdk/38/shared/Microsoft.NETCore.App/2.2.5/libcoreclr.so
#5  0x00007f888abf7ab3 in DispatchManagedException(PAL_SEHException&, bool) () from /snap/dotnet-sdk/38/shared/Microsoft.NETCore.App/2.2.5/libcoreclr.so
#6  0x00007f888ab7464a in IL_Throw(Object*) () from /snap/dotnet-sdk/38/shared/Microsoft.NETCore.App/2.2.5/libcoreclr.so
#7  0x00007f8812469928 in ?? ()
#8  0x0000000d00010002 in ?? ()
#9  0x0000000d00010002 in ?? ()
#10 0x0000000000000000 in ?? ()

Environment information

VSCode version: 1.34.0
C# Extension: 1.19.1

Mono Information OmniSharp using global mono :5.20.1
Dotnet Information (actual) A valid dotnet installation could not be found.
Dotnet Information (expected) .NET Core SDK (reflecting any global.json): Version: 2.2.204 Commit: 8757db13ec

Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /snap/dotnet-sdk/38/sdk/2.2.204/

Host (useful for support):
Version: 2.2.5
Commit: 0a3c9209c0

.NET Core SDKs installed:
2.2.204 [/snap/dotnet-sdk/38/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.5 [/snap/dotnet-sdk/38/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.5 [/snap/dotnet-sdk/38/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.5 [/snap/dotnet-sdk/38/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions
Extension Author Version
csharp ms-vscode 1.19.1
csharpextensions jchannon 1.3.0
docomment k--kato 0.1.7
Ionide-FAKE Ionide 1.2.3
Ionide-fsharp Ionide 3.37.0
Ionide-Paket Ionide 1.12.0
msbuild-project-tools tintoy 0.2.54
vscode-versionlens pflannery 0.23.0
@gregg-miskelly
Copy link
Contributor

@rmunn this isn't an issue with the C# extension, though I am not sure what I would suggest you do with this issue. If you run dotnet --info from a VS Code terminal, do you get anything more helpful?

@rmunn
Copy link
Author

rmunn commented May 21, 2019

If I run dotnet --info from the VS Code terminal, it works, and I get the expected output (which I included in the issue description under "Dotnet Information (expected)" in case it's useful). The only failure scenario I've been able to reproduce is for OmniSharp to be launching the dotnet --info command during VS Code startup.

I'm also not sure where the root cause of this bug lies; if I could figure out what exception is being thrown in IL_Throw from libcoreclr.so, I might have better luck putting this in the right place. But since the only time I can reproduce this bug is when OmniSharp is involved, I figure here is as good a place for the issue to live as any, at least until I can track down the cause better.

@anpn33
Copy link

anpn33 commented May 24, 2019

Have the same issue. After running "sudo snap alias dotnet-sdk.dotnet dotnet" dotnet --info works fine in a terminal, but I still get:
Failed to spawn 'dotnet --info'
from "C# for Visual Studio Code (powered by OmniSharp)."

@nelsontkq
Copy link

nelsontkq commented Jun 4, 2019

For a quick fix creating a symlink at /usr/local/bin/dotnet seems to solve the issue.
sudo ln -sv /snap/dotnet-sdk/current/dotnet /usr/local/bin/dotnet

@gregg-miskelly
Copy link
Contributor

I am going to close this issue since it isn't really about this extension. Note that I am adding a help link to the error message with #3507 which has specific troubleshooting steps for Snap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants