-
Notifications
You must be signed in to change notification settings - Fork 17
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
MSBuild project tools extension doesn't work when the SDK version specified in global.json isn't installed #156
Comments
Thanks for reporting - I’ve not seen that particular error before (this scenario is definitely supposed to work including the parsing of multiple versions so I’ll try to get a repro environment going to figure out where it’s going wrong). From memory, 6.x tooling changed how SDK versions are reported; I wonder if this is an edge case relating to that… |
The extension, these days, is meant to automatically acquire the required version of the .net SDK, so it’s also possible that it might be failing to see the version in global.json. CC: @DoctorKrolic |
The contents of D:\OB\svdcv2\global.json looks like this:
|
We did change this a little while ago to remove some legacy parsing logic for SDK tooling before 6.x but since you’re at 8.x it shouldn’t matter. We have some tests I can plug your output into to verify how the parser would behave so I’ll have a go at that this evening after work. What version of the extension do you have installed? |
The bit of the output that I find interesting is:
From memory, that only shows up when the If you run |
Get-Command for dotnet outputs this:
I'm using v0.6.3 of the extension |
I suspect we may need to do a better job of respecting SDK roll-forward policy (I’d need to check what the default is when one’s not specified in global.json). |
When you have a moment, can you also share the output of I suspect the issue may be due to running a preview SDK, which does not qualify for detection under the normal rules (we only support stable versions, under normal circumstances). It's something we may be able to handle in the future but for the moment preview SDKs are invisible to us (at least until we add opt-in support for them). |
Maybe related: #144 (comment) |
Here is the output from
|
Oddly, when I paste the output above into our parser tests, they have no problem parsing it. Could you do one last test for me, please? Can you add a setting to VSCode:
At that verbosity level it should log the full path to the SDK tooling that it’s using, and exact output it’s getting from |
@DoctorKrolic I think that legacy code path we removed a little while back may have handled this scenario a little better (and if nothing else it may be worth resurrecting some of the associated tests even if they need to be updated for the “modern” way of parsing the version info). I might have a go at doing that this weekend if you have no objections. |
I am not seeing any difference in the output window after adding that setting (in settings.json) and setting that environment variable before launching VSCode. |
Hmm, you should be seeing something like this in the output pane titled "MSBuild Language Service" (yes there are 2 output panes but we've had trouble using the same one from the extension and language service): |
Very strange - that does look correct and, yet, there are no verbose logs there. I don’t suppose those settings could be overridden by workspace-level settings or settings sync? Ok, 2 additional environment variables to try:
That should produce “raw” log that doesn’t have to first get sent back to VS Code in order to become visible… |
Okay, that resulted in this log file. |
Thanks! I think I that's helped me get to the root of the problem: It seems that our current implementation is failing to check the process exit code when running Unfortunately, we can't really recover in this scenario since the output from I do feel that we could probably look for that particular exit code and log a more useful message, however (together with suggested a solution and maybe a link to the Microsoft documentation on @DoctorKrolic - sound reasonable to you? I may also raise an issue in Microsoft's dotnet tooling repository just to get a definitive answer regarding expected exit codes. |
Well-known exit codes for the https://github.com/dotnet/runtime/blob/main/docs/design/features/host-error-codes.md |
…dly names in error messages tintoy/msbuild-project-tools-vscode#156
… resolve a matching runtime or SDK for global.json tintoy/msbuild-project-tools-vscode#156
When I have multiple .NET SDKs installed on my machine, the MSBuild project tools extension fails to start with this output:
This is the output from
dotnet --version
:For this repo, global.json specifies .NET SDK version 8.0.203, and that version isn't one of the three that's installed.
The extension needs to handle this situation better. Either use one of the three installed versions (it seems like it's treating the output section of "Installed SDKs" as a single version instead of three different versions) or more gracefully fail with information about what's going wrong and how to fix it.
The text was updated successfully, but these errors were encountered: