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. #74

Closed henrik-jensen closed 3 years ago

henrik-jensen commented 3 years ago

I think it was after upgrading to vscode 1.53.2 this started, but honestly I'm not certain.

System info:

MSBuild Project Tools output:

Starting MSBuild language service...
Failed to start the MSBuild language server.
Error: Command failed: "C:\Program Files\dotnet\dotnet.EXE" "c:\Users\henrik\.vscode\extensions\tintoy.msbuild-project-tools-0.3.13\out\language-server\MSBuildProjectTools.LanguageServer.Host.dll" --probe
System.ArgumentException: Version string portion was too short or too long. (Parameter 'input')
   at System.Version.ParseVersion(ReadOnlySpan`1 input, Boolean throwOnFailure)
   at System.Version.Parse(String input)
   at System.Version..ctor(String version)
   at MSBuildProjectTools.LanguageServer.Utilities.MSBuildHelper.DiscoverMSBuildEngine(String baseDirectory, ILogger logger) in C:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\MSBuildHelper.cs:line 97
   at MSBuildProjectTools.LanguageServer.Program.Main() in C:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer\Program.cs:line 49

System.ArgumentException: Version string portion was too short or too long. (Parameter 'input')
   at System.Version.ParseVersion(ReadOnlySpan`1 input, Boolean throwOnFailure)
   at System.Version.Parse(String input)
   at System.Version..ctor(String version)
   at MSBuildProjectTools.LanguageServer.Utilities.MSBuildHelper.DiscoverMSBuildEngine(String baseDirectory, ILogger logger) in C:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\MSBuildHelper.cs:line 97
   at MSBuildProjectTools.LanguageServer.Program.Main() in C:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer\Program.cs:line 49
tintoy commented 3 years ago

What happens if you run dotnet --info in your workspace directory? Can you post the output?

henrik-jensen commented 3 years ago

Woah, thx for the fast reply :-)

dotnet --info in workspace directory:

.NET SDK (reflecting any global.json):
 Version:   5.0.200-preview.20601.7
 Commit:    b3b934bbf2

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\

Host (useful for support):
  Version: 5.0.2
  Commit:  cb5f173b96

.NET SDKs installed:
  2.1.200-preview-007597 [C:\Program Files\dotnet\sdk]
  2.1.200 [C:\Program Files\dotnet\sdk]
  2.1.201 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.400-preview-009063 [C:\Program Files\dotnet\sdk]
  2.1.400-preview-009171 [C:\Program Files\dotnet\sdk]
  2.1.400 [C:\Program Files\dotnet\sdk]
  2.1.500-preview-009297 [C:\Program Files\dotnet\sdk]
  2.1.500-preview-009335 [C:\Program Files\dotnet\sdk]
  2.1.500-preview-009404 [C:\Program Files\dotnet\sdk]
  2.1.520 [C:\Program Files\dotnet\sdk]
  2.1.600 [C:\Program Files\dotnet\sdk]
  2.1.617 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009597 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009601 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009618 [C:\Program Files\dotnet\sdk]
  2.1.800-preview-009677 [C:\Program Files\dotnet\sdk]
  2.1.800-preview-009696 [C:\Program Files\dotnet\sdk]
  2.1.800 [C:\Program Files\dotnet\sdk]
  3.1.405 [C:\Program Files\dotnet\sdk]
  5.0.200-preview.20601.7 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
tintoy commented 3 years ago

Ah. Ok, I wasn't aware that the SDK version was using SemVer. Thanks, that will be relatively easy to fix.

If you need to get going right away, you can use global.json to lock your SDK to the latest stable version of the .NET SDK.

henrik-jensen commented 3 years ago

Ah. Ok, I wasn't aware that the SDK version was using SemVer. Thanks, that will be relatively easy to fix.

If you need to get going right away, you can use global.json to lock your SDK to the latest stable version of the .NET SDK.

Good to know, but it's ok right now. I'll just wait to use/edit MSBuild projects until it's fixed and just use VS2019 if absolutely needed.

And thanks a bunch for this extension. πŸ₯‡ --henrik

tintoy commented 3 years ago

msbuild-project-tools-0.3.14.vsix.zip

When you have time, can you try uninstalling the extension and installing it from this VISX package? I think this should fix the problem but I don't any preview versions of the SDK installed at the moment to test with :)

henrik-jensen commented 3 years ago

msbuild-project-tools-0.3.14.vsix.zip

When you have time, can you try uninstalling the extension and installing it from this VISX package? I think this should fix the problem but I don't any preview versions of the SDK installed at the moment to test with :)

I'll give it a go and report back.

henrik-jensen commented 3 years ago

MSBuild Project Tools output after install of msbuild-project-tools-0.3.14.vsix:

Starting MSBuild language service...
MSBuild language service is running.

πŸ‘ πŸ‘ πŸ‘ Succes

Edit: Sorry, I don't have time right now to do a more extensive test but I'll load som msbuild projects up later and test them out.

tintoy commented 3 years ago

Thanks - will publish the new version soon :)

henrik-jensen commented 3 years ago

I wondered a bit about the preview of dotnet sdk but of course I'm on the preview channel of VS 2019:

Microsoft Visual Studio Community 2019 Preview
Version 16.9.0 Preview 2.0

I'll soon update to VS2019 16.9.0 Preview 4.0 and report back (though I'll guess it'll work just fine). If there are any specific test you would like me to do with regard to your msbuild-project-tools-vscode extension and the VS2019 preview dotnet, please let me know, and I'll find some time to do them later.

henrik-jensen commented 3 years ago

Updated to VS2019 16.9.0 Preview 4.0 with load succes.

Starting MSBuild language service...
MSBuild language service is running.

... but loading a csproj did give me this in MSBuild Project Tools:

[Info  - 12.56.08] Using MSBuild engine v5.0.200 from "C:\Program Files\dotnet\sdk\5.0.200-preview.21079.7\".
[Info  - 12.56.08] 1 package sources configured for project "c:\Users\henrik\Documents\UninstallingNetBeans\registry\split_at_min_size_at_pattern\split_at_min_size_at_pattern.csproj".
[Info  - 12.56.08]   Locally-configured package source "nuget.org" (v2) => https://www.nuget.org/api/v2/
[Error - 12.56.10] Error scanning NuGet package references for MSBuild project '"c:\Users\henrik\Documents\UninstallingNetBeans\registry\split_at_min_size_at_pattern\split_at_min_size_at_pattern.csproj"'.
System.ArgumentNullException: Value cannot be null. (Parameter 'keyValuePairs')
   at void MSBuildProjectTools.LanguageServer.Utilities.CollectionExtensions.AddRange<TKey, TValue>(IDictionary<TKey, TValue> dictionary, IEnumerable<KeyValuePair<TKey, TValue>> keyValuePairs) in C:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Utilities\CollectionExtensions.cs:line 62
   at async Task<bool> MSBuildProjectTools.LanguageServer.Documents.ProjectDocument.UpdatePackageReferences(CancellationToken cancellationToken) in C:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\ProjectDocument.cs:line 426
[Info  - 12.56.10] Successfully loaded project "c:\Users\henrik\Documents\UninstallingNetBeans\registry\split_at_min_size_at_pattern\split_at_min_size_at_pattern.csproj".

Don't know if it was also present in VS2019 16.9.0 Preview 2.0, but it seems to be unrelated and did successfully load the project according to the log. Should I close this issue Failed to start the MSBuild language server, and start a new one this or is it to trivial?

tintoy commented 3 years ago

Ouch that seems like a silly bug (NREs usually are πŸ™‚). Can you leave this one open and I’ll take a look later this morning?

Thanks for the detailed report!

henrik-jensen commented 3 years ago

I'll leave it open. Happy coding.

tintoy commented 3 years ago

Published v0.3.15 πŸ™‚

henrik-jensen commented 3 years ago

Thanks @tintoy Great work. FYI: v0.3.15 even works with the latest VS2019 16.9.0 Preview 5.0, just released. (VS2019 Preview is a fast moving target at the moment, it seems)

tintoy commented 3 years ago

Glad to hear it! πŸ˜ƒ

I’ve generally found MSBuild to be a fast-moving target in the .NET Core world, so it’s good to hear that the solution we’ve chosen seems to be working πŸ‘