tintoy / msbuild-project-tools-vscode

VS Code extension for MSBuild intellisense (including PackageReference completion).
MIT License
82 stars 16 forks source link

Failed to start the MSBuild language server after updating to v0.5.0 #137

Closed glen-84 closed 7 months ago

glen-84 commented 7 months ago
Starting MSBuild language service...
Failed to start the MSBuild language server.
Error: Command failed: "/home/glen/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/6.0.25~x64/dotnet" "/home/glen/.vscode-server/extensions/tintoy.msbuild-project-tools-0.5.0/language-server/MSBuildProjectTools.LanguageServer.Host.dll" --probe
System.InvalidOperationException: The 'dotnet --version' command did not return any output.
   at MSBuildProjectTools.LanguageServer.Utilities.DotNetRuntimeInfo.ParseDotNetVersionOutput(TextReader dotnetVersionOutput)
   at MSBuildProjectTools.LanguageServer.Utilities.DotNetRuntimeInfo.GetCurrent(String baseDirectory, ILogger logger)
   at MSBuildProjectTools.LanguageServer.Utilities.MSBuildHelper.DiscoverMSBuildEngine(String baseDirectory, ILogger logger)
   at MSBuildProjectTools.LanguageServer.Program.Main()

System.InvalidOperationException: The 'dotnet --version' command did not return any output.
   at MSBuildProjectTools.LanguageServer.Utilities.DotNetRuntimeInfo.ParseDotNetVersionOutput(TextReader dotnetVersionOutput)
   at MSBuildProjectTools.LanguageServer.Utilities.DotNetRuntimeInfo.GetCurrent(String baseDirectory, ILogger logger)
   at MSBuildProjectTools.LanguageServer.Utilities.MSBuildHelper.DiscoverMSBuildEngine(String baseDirectory, ILogger logger)
   at MSBuildProjectTools.LanguageServer.Program.Main()

WSL (Debian) on Windows 11.

tintoy commented 7 months ago

Thanks - will investigate shortly! Can you post the output of dotnet --info?

AdamCoulterOz commented 7 months ago

same here (on macOS 14.1.1):

% "/Users/adam/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/6.0.25~arm64/dotnet" \
  "/Users/adam/.vscode/extensions/tintoy.msbuild-project-tools-0.5.0/language-server/MSBuildProjectTools.LanguageServer.Host.dll" \
  --probe

System.InvalidOperationException: The 'dotnet --version' command did not return any output.
   at MSBuildProjectTools.LanguageServer.Utilities.DotNetRuntimeInfo.ParseDotNetVersionOutput(TextReader dotnetVersionOutput)
   at MSBuildProjectTools.LanguageServer.Utilities.DotNetRuntimeInfo.GetCurrent(String baseDirectory, ILogger logger)
   at MSBuildProjectTools.LanguageServer.Utilities.MSBuildHelper.DiscoverMSBuildEngine(String baseDirectory, ILogger logger)
   at MSBuildProjectTools.LanguageServer.Program.Main()

For dotnet --info

% "/Users/adam/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/6.0.25~arm64/dotnet" \
  --info

global.json file:
  Not found

Host:
  Version:      6.0.25
  Architecture: arm64
  Commit:       492abbeef0

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.NETCore.App 6.0.25 [/Users/adam/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/6.0.25~arm64/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info
glen-84 commented 7 months ago

Thanks - will investigate shortly! Can you post the output of dotnet --info?

/home/glen/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/6.0.25~x64/dotnet --info

global.json file:
  /home/glen/projects/api/global.json

Host:
  Version:      6.0.25
  Architecture: x64
  Commit:       492abbeef0

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.NETCore.App 6.0.25 [/home/glen/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/6.0.25~x64/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info
glen-84 commented 7 months ago
/home/glen/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/6.0.25~x64/dotnet --version
The command could not be loaded, possibly because:
  * You intended to execute a .NET application:
      The application '--version' does not exist.
  * You intended to execute a .NET SDK command:
      A compatible .NET SDK was not found.

Requested SDK version: 8.0.100
global.json file: /home/glen/projects/api/global.json

Installed SDKs:
No .NET SDKs were found.

Install the [8.0.100] .NET SDK or update [/home/glen/projects/api/global.json] to match an installed SDK.

Download a .NET SDK:
https://aka.ms/dotnet-download

Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found
Martin521 commented 7 months ago

Same here (Windows11/WSL2, Dev Containers)

tintoy commented 7 months ago

Just for now (so we don't affect anyone else while we investigate), I have rolled back to the previous version (v0.4.9) by publishing it as v0.5.1. The new package should appear in the gallery soon.

tintoy commented 7 months ago

@AdamCoulterOz and @glen-84 - it seems to indicate that there are no .NET SDKs installed on your system, is that correct? Or is this just a result of running it from that location?

If you remove the path prefix from the dotnet command, do you get different output?

tintoy commented 7 months ago

@DoctorKrolic - from the output above, it seems that the .NET runtime acquired via the vscode-dotnet-runtime extension is isolated and does not see any of the .NET SDKs installed the regular way...

Is this the behaviour that you've seen while working with it?

tintoy commented 7 months ago

@Martin521 - do you have the .NET SDK installed your dev container?

glen-84 commented 7 months ago

@AdamCoulterOz and @glen-84 - it seems to indicate that there are no .NET SDKs installed on your system, is that correct? Or is this just a result of running it from that location?

The latter. (I have SDKs installed)

If you remove the path prefix from the dotnet command, do you get different output?

Yes.

tintoy commented 7 months ago

@glen-84 - ok, thanks, it sounds like we need to find a way to locate the global dotnet executable and associated SDKs after the extension has been loaded by the isolated runtime.

glen-84 commented 7 months ago

Also, not sure why it installs .NET 6.

tintoy commented 7 months ago

Also, not sure why it installs .NET 6.

I think that's because it's the version that the language server was built against.

tintoy commented 7 months ago

@DoctorKrolic - this might do the trick:

https://github.com/dotnet/vscode-dotnet-runtime/tree/main/vscode-dotnet-runtime-extension#i-already-have-a-net-runtime-or-sdk-installed-and-i-want-to-use-it

together with:

https://stackoverflow.com/a/58838114

Martin521 commented 7 months ago

@Martin521 - do you have the .NET SDK installed your dev container?

Yes, 8.0.0-rc.1.23419.4 (Config here)

AdamCoulterOz commented 7 months ago

I've got 8.0.100 installed

DoctorKrolic commented 7 months ago

I made a PR which sould resolve this. I described what exactly happened and why we were not able to catch this during development there. In the meantime I apologize for the inconvenience. There are only 2 of us maintaining the extension, so we don't have enough resources to cover all cases when testing. Thanks for patience and the contribution, your logs and other info were pretty useful!

tintoy commented 7 months ago

Yeah, sorry I should have been more thorough when testing the new changes; I don’t have a Mac anymore but I normally try to smoke-test each release in WSL and dev containers before publishing.

(I’ve spent too much time this month fighting kops and terraform so I’ve been a little distracted 😂)

Martin521 commented 7 months ago

Thanks to both of you for providing this great extension and for the quick reaction!