ionide / ionide-vscode-fsharp

VS Code plugin for F# development
http://ionide.io
MIT License
859 stars 277 forks source link

I regularly see "Cannot start .NET Core language services because `dotnet` was not found" on macOS #1686

Closed samritchie closed 2 years ago

samritchie commented 2 years ago

Describe the bug

When opening a project in vscode, I will often see the message:

Cannot start .NET Core language services because `dotnet` was not found. Consider: 
* setting the `FSharp.dotnetRoot` settings key to a directory with a `dotnet` binary, 
* including `dotnet` in your PATH, or
* installing .NET Core into one of the default locations.

Generally closing/re-opening or quitting & restarting several times will rectify the error and Ionide will launch successfully.

I probably first saw the behaviour 6-12 months ago, but it was fairly infrequent. I've just upgraded to a faster machine and now see the error much more often - possibly this is indicating some sort of race condition?

Steps to reproduce

  1. Open an F# project in VS Code on the mac using default settings (no FSharp.dotnetRoot setting, dotnet installed in default location and on PATH)

Link to sample reproduction

Appears to affect all F# projects

Expected behaviour

Launch Ionide successfully

Machine info

Runtime Environment: OS Name: Mac OS X OS Version: 12.3 OS Platform: Darwin RID: osx.12-arm64 Base Path: /usr/local/share/dotnet/sdk/6.0.201/

Host (useful for support): Version: 6.0.3 Commit: c24d9a9c91

.NET SDKs installed: 6.0.201 [/usr/local/share/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]


 - Ionide version: v5.12.0

### Additional context

`dotnet` installed via package installer and added to the path by the installer (ie in `/etc/paths.d`). I'm running oh-my-zsh and sometimes see the slow shell resolution warning on first boot when it restores vscode windows & launches other apps, but not during normal usage.

Note that hardcoding the path to `dotnet` in the `FSharp.dotnetRoot` appears to work around the problem, but I would expect Ionide to be able to reliably pick up `dotnet` either from the PATH or the default install location.
DaveJohnson8080 commented 2 years ago

I have the same issue on Linux. It appears to happen if OmniSharp takes longer than usual to start.

vilinski commented 2 years ago

Experienced this with installed MSBuild Project tools extension.