Skip to content
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

OmniSharp.SdkInstanceProvider fails to parse 'omnisharp.sdkVersion' and 'omnisharp.sdkPath' #2412

Closed
BBergquist opened this issue Jun 22, 2022 · 7 comments · Fixed by dotnet/vscode-csharp#5301 or dotnet/vscode-csharp#5459

Comments

@BBergquist
Copy link

Repro (using the latest version of OmniSharp w/ omnisharp.useModernNet enabled):

  1. Override omnisharp.sdkVersion or omnisharp.sdkPath with any value (including the recommended values: "6.0.300" or "/home/username/dotnet/sdks/6.0.300").
  2. Restart OmniSharp.

Expected behavior: OmniSharp successfully restarts, finding the specified SDK version from the user settings.

Actual behavior: [fail]: OmniSharp.MSBuild.Discovery.Providers.SdkInstanceProvider The Sdk version specified in the OmniSharp settings was not a valid semantic version. Configured version is ''6.0.300''. Please update your settings and restart OmniSharp.

I checked the regex found in the code. 6.0.300 (no quotes) is a valid semantic version, but '6.0.300' is not. That paired with the logging message showing double ticks suggests that OmniSharp is receiving the setting value with extra quotes and needs to strip them out.

@BBergquist
Copy link
Author

The impact is that this bug prevents users from building .NET Core 3.1 SDK-style projects.

@JoeRobich
Copy link
Member

@BBergquist So the issue is with the setting descriptions. Let me remove the quotes from the recommended values as they were not intended to part of the value.

@estellise-yukihime
Copy link

I'm still receiving this same error when I tried setting the sdkPath and the sdkVersion on v1.25.1-beta.

@JoeRobich
Copy link
Member

@estellise-yukihime What values are you using?

@mcm-ham
Copy link

mcm-ham commented Sep 26, 2022

@JoeRobich These are my values in vscode settings.json:

{
  "omnisharp.sdkVersion": "6.0.401",
  "omnisharp.sdkPath": "/usr/local/share/dotnet/sdk/6.0.401/"
}

This is the omnisharp log:

[fail]: OmniSharp.MSBuild.Discovery.Providers.SdkInstanceProvider
        The Sdk version specified in the OmniSharp settings was not a valid semantic version. Configured version is ''6.0.401''. Please update your settings and restart OmniSharp.
[fail]: OmniSharp.MSBuild.Discovery.Providers.SdkOverrideInstanceProvider
        The Sdk path specified in the OmniSharp settings does not exist. Configured path is ''/usr/local/share/dotnet/sdk/6.0.401/''. Please update your settings and restart OmniSharp.

Is it because the VSCode extension adds the quotes here:
https://github.com/OmniSharp/omnisharp-vscode/blob/55bc0546da2a3b233133d1dca3eee2e1e964f59f/src/omnisharp/server.ts#L403
Which other options don't have.

@mcm-ham
Copy link

mcm-ham commented Sep 28, 2022

That fixed it for me, if I edit /Users/user/.vscode/extensions/ms-dotnettools.csharp-1.25.0-darwin-arm64/dist/extension.js to remove those quotes it now works.

@tvardero
Copy link

Please reopen the issue, it is not solved.

[fail]: OmniSharp.MSBuild.Discovery.Providers.SdkInstanceProvider
        The Sdk version specified in the OmniSharp settings was not a valid semantic version. Configured version is ''6.0.403''. Please update your settings and restart OmniSharp.
[fail]: OmniSharp.MSBuild.Discovery.Providers.SdkOverrideInstanceProvider
        The Sdk path specified in the OmniSharp settings does not exist. Configured path is ''C:/Program Files/dotnet/sdk/6.0.403''. Please update your settings and restart OmniSharp.
"omnisharp.sdkPath": "C:/Program Files/dotnet/sdk/6.0.403",
"omnisharp.sdkVersion": "6.0.403",

Omnisharp version v1.25.2

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