Omnisharp-vscode: Omnisharp stopped working with a Failed to spawn 'dotnet --info' log

Created on 4 Jan 2017  路  13Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output: "Failed to spawn 'dotnet --info'"
VS Code version: 1.8.1
C# Extension version: 1.6.2

Steps to reproduce

Starting vs code and change language to c#

Expected behavior

Omnisharp starting up and working

Actual behavior

Omnisharp simply disappeared.

As stated above, I started coding for unity with Omnisharp and vscode last week and everything is fine.
However, after the new year break, when I returned this week, Omnisharp just stopped working for no reason. the little fire icon disappears, both c# and omnisharp log is empty, intellisense gone.

I tried to uninstall and reinstall the C# extension from vs code and when the extension tries to download and install omnisharp, it ended up with a "Failed to spawn 'dotnet --info'" log after downloaded both omnisharp and the .NET Core Debugger.
Uninstall vscode and deleting everything under both the extension folder and the appdata folder doesn't help either.
All I got now is an error message in C# log every time I start up vs code and it's always this "Failed to spawn 'dotnet --info'"

What should I do to locate the cause of the problem and bring back Omnisharp??

Most helpful comment

The best answer I can provide is to fully remove the C# extension and reinstall it. However, the problem that you're describing does not sound like it is related to the C# extension. I have a hard time believing that nothing has changed on your machine. :smile:

To uninstall, try the following:

  1. Close Visual Studio Code.
  2. Browse to %UserProfile%\.vscode\extensions and delete all ms-vscode.csharp-* extensions.

Now, open Visual Studio Code and reinstall from the Extensions pane.

All 13 comments

To clarify, are you unable to run dotnet --info at the command-line?

Just to clarify, My problem is that omnisharp no longer works.
And no, I get a message telling me dotnet is not a command when I try to run dotnet --info.
I've checked and I got .net 4.5.1, 4.6 and 4.6.1 (SDK and targeting pack)installed.
Am I missing the actual .net ? Or did my system path somehow messed up?

If dotnet isn't working at the command line then that's why you're seeing an error in VS Code. I suspect it's an install issue with the .NET CLI. Note that this is different than the .NET Framework versions that you listed. Have you installed the .NET CLI at any point? What operating system are you running on?

Am I missing the actual .net ? Or did my system path somehow messed up?

That I couldn't tell you.

@DustinCampbell

Have you installed the .NET CLI at any point?

No, All I did is turning my computer off before new year and turn it on after new year :(

What operating system are you running on?

I'm using win10 x64 now.
Here's my system path config:
C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;E:\Program Files (x86)\GtkSharp\2.12\bin

The best answer I can provide is to fully remove the C# extension and reinstall it. However, the problem that you're describing does not sound like it is related to the C# extension. I have a hard time believing that nothing has changed on your machine. :smile:

To uninstall, try the following:

  1. Close Visual Studio Code.
  2. Browse to %UserProfile%\.vscode\extensions and delete all ms-vscode.csharp-* extensions.

Now, open Visual Studio Code and reinstall from the Extensions pane.

@DustinCampbell Already did that for at least 3 times....
I even tried to uninstall the whole VSC, including all the extensions and settings under AppData\Roaming\Code
Everytime it's the same message 'Failed to spawn dotnet --info'.

I have a hard time believing that nothing has changed on your machine.

Hmm, Maybe something I did after setting up Omnisharp for VSC and before I turned off my computer?

  1. I uninstalled a x64 version of mono project, which I installed when I tries to use sublime text for C# coding. (Tried re-install it after I ran into this problem but changes nothing)
    2.installed several java related extensions for VSC and a redhat jdk.

Also adding in @gregg-miskelly, because it looks like the error comes from here: https://github.com/OmniSharp/omnisharp-vscode/blob/9515f408efc4672658a0e3b6ce6cf1036673712a/src/coreclr-debug/util.ts#L123.

@DustinCampbell It's getting weirder... I downloaded and installed .net Core 1.03 SDK manually.
Now after installing C# extension, no failed message popping up.
However, Omnisharp IS STILL MISSING!!!
Nothing on C# console, Nothing on Omnisharp console and Nothing on developer tools' console...
So freaking frustrated, the VS code and omnisharp on my laptop works perfectly but my desktop omnisharp just refused to show itself....

Try this:

  1. Close Visual Studio Code.
  2. Delete the following directories and files on your hard drive:

    • %USERPROFILE%\.vscode\extensions\ms-vscode.csharp-1.6.2\.debugger

    • %USERPROFILE%\.vscode\extensions\ms-vscode.csharp-1.6.2\bin

    • %USERPROFILE%\.vscode\extensions\ms-vscode.csharp-1.6.2\install.lock

  3. Start Visual Studio Code and open a C# project

At this point, it should try to download the debugger and omnisharp again.

@Fire1nRain that actually makes sense -- the error you were seeing should have had nothing to do with running OmniSharp. Sounds like you have already moved past it, but if you don't want the .NET CLI installed, you should be able to remove it and add the config option 'suppressDotnetInstallWarning=true' to disable attempting to install the debugger.

@DustinCampbell
The install finished with no error, but Omnisharp still missing

Updating C# dependencies...
Platform: win32, x86_64 (win7-x64)

Downloading package 'OmniSharp (.NET 4.6 / x64)' (17539 KB) .................... Done!
Downloading package '.NET Core Debugger (Windows / x64)' (39828 KB) .................... Done!

Installing package 'OmniSharp (.NET 4.6 / x64)'
Installing package '.NET Core Debugger (Windows / x64)'

Finished

@gregg-miskelly VS code tells me to add the config option the first time I installed it too. But now, I got nothing, I think VS code and C# extension is not even close to detecting .NET CLI installation before something went wrong.
The problem is: there's no error log anywhere so I've got no way to tell what went wrong..

OMFG!!! I'm such a dumb-ass!! The .sln and project.json files under my project somehow disappeared and I didn't noticed it!!
Sorry for all the trouble @DustinCampbell @gregg-miskelly , I feel so dumb after finding out the cause.
Also, Can you guys add a notification or something like "No .sln file found!" for dumb people like me?

Was this page helpful?
0 / 5 - 0 ratings