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

8.0.10 Runtime Failed - NET: The requested and or resolved version is invalid. #2021

Closed
AliArtWorks opened this issue Nov 13, 2024 · 23 comments
Labels
bug Something isn't working client:csharp Issues raised by the C# extention(s) or users of that extension. cost: small P0

Comments

@AliArtWorks
Copy link

AliArtWorks commented Nov 13, 2024

Information About This Issue

Hi! I am the maintainer of this extension, so I'm gonna provide you some answers. Sorry for all of this hassle.
I've (@nagilson) edited your issue and left your original issue untouched on the bottom.

Work Around

❗ This has been fixed in the new release of the C# extension, version 2.55.29. Please try to get to that version, first.

Install the 8.0 SDK using the '.NET Install Tool - Install SDK Command', and or, rollback C# extension to version to 2.50.27 (Click on the down arrow next to uninstall button from extension details page).

Video from @peyronth here as to how: #2022 (comment)

385691723-8fbe8cc8-fd61-4a87-a3cf-eae7239f4b33.webm

Resolution

I'm helping to coordinate a release of C# with an emergency hot fix -- I think the correct fix is in the C# extension, more work would need to be done to properly support Major.Minor.Patch requests and suppressing the error on our side might cause unexpected issues.

Explanation

This is a bug in the C# Extension.
Here is the line of code causing this problem: https://github.com/dotnet/vscode-csharp/blob/eb38986a52a8be7221d0e466f7a25c98dcbd7825/src/lsptoolshost/dotnetRuntimeExtensionResolver.ts#L19

It looks like this is exactly it. It passes 8.0.10 to our Runtime Acquisition API, but the way the runtime API is designed is to only support major.minor versions. The SDK API accepts many different formats, and the findPath API is going to support patch versions, but not the acquire runtime API. This is documented here, but it should probably be documented better:

* @property version - The major.minor version of the SDK or Runtime desired.

The acquire API will always acquire the 'latest' 8.0 runtime, so I would revert back to that change, as latest is always gonna be 8.0.10 or higher now.

Our line of code is here:

const err = new DotnetVersionResolutionError(new EventCancellationError('DotnetVersionResolutionError',
Where it rejects the request if its not of the form Major.Minor.
Our data mechanisms show 98.8+ Success Rate for detecting this fault did not get triggered because it counted this as an invalid request.

Original Issue

Describe the bug.

I already installed .net pakcage but i see this error popping up every time i open vs code, by the way this request is done by unity for vs code extension:
An error occurred while installing .NET: The requested and or resolved version is invalid.
Cancelled Installation of .NET 8.0.10.
The requested and or resolved version is invalid.
Cancelled Installation of .NET 8.0.10.
The requested and or resolved version is invalid.
Cancelled Installation of .NET 8.0.10.
The requested and or resolved version is invalid.
Cancelled Installation of .NET 8.0.10.
The requested and or resolved version is invalid.
Cancelled Installation of .NET 8.0.10.
The requested and or resolved version is invalid.
Cancelled Installation of .NET 8.0.10.
The requested and or resolved version is invalid.
visualstudiotoolsforunity.vstuc requested to download the .NET Runtime.
Downloading .NET version(s) 8.0.11~x64 ...Cancelled Installation of .NET 8.0.10.
The requested and or resolved version is invalid.
Cancelled Installation of .NET 8.0.10.
The requested and or resolved version is invalid.

Please attach log file(s) here if you have any.

Please attach the log file located at DotNetAcquisition-ms-dotnettools.vscode-dotnet-runtime-1731471856933.txt
DotNetAcquisition-ms-dotnettools.vscode-dotnet-runtime-1731471856933.txt. Note that this file may contain personal data.

Extension Version: 1.0.0
Error Message: The requested and or resolved version is invalid.
Error Stack: Error: The requested and or resolved version is invalid.
at t.VersionResolver.resolveVersion (c:\Users\anonymous.vscode\extensions\ms-dotnettools.vscode-dotnet-runtime-2.2.2\dist\extension.js:2:114800)
at c:\Users\anonymous.vscode\extensions\ms-dotnettools.vscode-dotnet-runtime-2.2.2\dist\extension.js:2:114261
at new Promise ()
at t.VersionResolver. (c:\Users\anonymous.vscode\extensions\ms-dotnettools.vscode-dotnet-runtime-2.2.2\dist\extension.js:2:114217)
at Generator.next ()
at s (c:\Users\anonymous.vscode\extensions\ms-dotnettools.vscode-dotnet-runtime-2.2.2\dist\extension.js:2:112801)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Reproduction Steps

just open up vs code with requirement installed for unity.

Expected Behavior

it should download it just fine.

Exceptions & Errors (if any)

No response

.NET Install Tool Version

2.2.2

Your operating system? Please provide more detail, such as the version and or distro above.

Windows

VS Code Version

No response

@clear-zhao
Copy link

I encountered the same issue due to the .NET Install Tool extension. According to its documentation,

this extension offers a unified approach for other extensions like C# and C# Dev Kit to install local versions of the .NET Runtime and machine-wide versions of the .NET SDK. These extensions inform the .NET Install Tool when they require a specific version of .NET SDK, and if it is not already installed, we provide them with one that matches their requirements for proper functioning. Alternatively, users can also manually install the required .NET SDK by referring to the instructions below.

Therefore, my suggestion is that some of your C# extensions might be assuming that your current version of .NET SDK is outdated (this is just an assumption).
So far, my only successful solution has been deleting my existing .NET SDK and downloading a newer version from the official website (preferably >=8.0.10).
This ensures that when I open Visual Studio Code next time, there are no error reports or unnecessary downloads.

https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.vscode-dotnet-runtime

@clear-zhao
Copy link

I download .net sdk 8.0.404 and it won't go wrong.
Image

@clear-zhao
Copy link

I download .net sdk 8.0.404 and it won't go wrong. Image

But I still have a question, does every time an extension thinks that my.NET version is too low, I have to go to download it again? This is too troublesome, is there a better solution, or simply my network problem😅

@manueljtala
Copy link

manueljtala commented Nov 13, 2024

I had the same (apparently) error in Visual Studio Code today and I have MacOS Sonoma 14.5, maybe a coincidence, or not.

I solved it reinstalling dotnet.

@KendallGuerra04
Copy link

x2 @manueljtala I have the same problem.

@manueljtala
Copy link

Ok...I thought that the problem was solved, but now vscode doesn't detect the project, I cannot navigate to classes, find references...etc

@hdpotter
Copy link

Same issue here. An easy temporary fix that worked for me is to downgrade the newly updated C# extension as described here.

@solixzsys
Copy link

Same issue here. An easy temporary fix that worked for me is to downgrade the newly updated C# extension as described here.

This safe me. I checked the c# extension and noticed it updated itself like 16hrs ago. have to rollback to version 2.50

@fnfup
Copy link

fnfup commented Nov 13, 2024

Same, had to rollback, this is definitely an issue.

@ASCP11
Copy link

ASCP11 commented Nov 13, 2024

Im having this problem too. Had to rollback to older version

@mkline1554
Copy link

Same issue here. An easy temporary fix that worked for me is to downgrade the newly updated C# extension as described here.

This solution worked for me from @hdpotter.

@nagilson
Copy link
Member

nagilson commented Nov 13, 2024

Hi! I am the maintainer of this extension, so I'm gonna provide you some answers. Sorry for all of this hassle.

Work Around

❗ This has been fixed in the new release of the C# extension, version 2.55.29. Please try to get to that version, first.

Install the 8.0 SDK using the '.NET Install Tool - Install SDK Command', and or, rollback C# extension to version to 2.50.27 (Click on the down arrow next to uninstall button from extension details page). In the coming days, make sure to re-enable extension updates so you get future bug fixes.

Video from @peyronth here as to how: #2022 (comment)

385691723-8fbe8cc8-fd61-4a87-a3cf-eae7239f4b33.webm

Resolution

I'm helping to coordinate a release of C# with an emergency hot fix -- I think the correct fix is in the C# extension, more work would need to be done to properly support Major.Minor.Patch requests and suppressing the error on our side might cause unexpected issues.

Explanation

This is a bug in the C# Extension.
Here is the line of code causing this problem: https://github.com/dotnet/vscode-csharp/blob/eb38986a52a8be7221d0e466f7a25c98dcbd7825/src/lsptoolshost/dotnetRuntimeExtensionResolver.ts#L19

It looks like this is exactly it. It passes 8.0.10 to our Runtime Acquisition API, but the way the runtime API is designed is to only support major.minor versions. The SDK API accepts many different formats, and the findPath API is going to support patch versions, but not the acquire runtime API. This is documented here, but it should probably be documented better:

* @property version - The major.minor version of the SDK or Runtime desired.

The acquire API will always acquire the 'latest' 8.0 runtime, so I would revert back to that change, as latest is always gonna be 8.0.10 or higher now.

Our line of code is here:

const err = new DotnetVersionResolutionError(new EventCancellationError('DotnetVersionResolutionError',
Where it rejects the request if its not of the form Major.Minor.
Our data mechanisms show 98.8+ Success Rate for detecting this fault did not get triggered because it counted this as an invalid request.

@nagilson nagilson added client:csharp Issues raised by the C# extention(s) or users of that extension. P0 bug Something isn't working cost: small and removed untriaged labels Nov 13, 2024
nagilson added a commit to nagilson/vscode-csharp that referenced this issue Nov 13, 2024
Resolves dotnet/vscode-dotnet-runtime#2021

# ! This should be released as a high sev hot-fix release 🔥

This is a bug in the C# Extension.
Here is the line of code causing this problem: https://github.com/dotnet/vscode-csharp/blob/eb38986a52a8be7221d0e466f7a25c98dcbd7825/src/lsptoolshost/dotnetRuntimeExtensionResolver.ts#L19

It looks like this is exactly it. It passes 8.0.10 to our Runtime Acquisition API, but the way the runtime API is designed is to only support major.minor versions. The SDK API accepts many different formats, and the findPath API is going to support patch versions, but not the acquire runtime API. This is documented here, but it should probably be documented better: https://github.com/dotnet/vscode-dotnet-runtime/blob/99112a0d6689b1bc01ff9dcf117368ea79c943b5/vscode-dotnet-runtime-library/src/IDotnetAcquireContext.ts#L15


The acquire API will always acquire the 'latest' 8.0 runtime, so I would revert back to that change, as latest is always gonna be 8.0.10 or higher now. 

Our line of code is here: https://github.com/dotnet/vscode-dotnet-runtime/blob/99112a0d6689b1bc01ff9dcf117368ea79c943b5/vscode-dotnet-runtime-library/src/Acquisition/VersionResolver.ts#L146 Where it rejects the request if its not of the form Major.Minor. 
Our data mechanisms show 98.8+ Success Rate for detecting this fault did not get triggered because it counted this as an invalid request.
@nagilson
Copy link
Member

Proposed Fix PR here dotnet/vscode-csharp#7769

@VodaJP
Copy link

VodaJP commented Nov 13, 2024

This guy send updates without a proper testing and/or testing environment

@adrocic
Copy link

adrocic commented Nov 13, 2024

@nagilson Thanks for the response on this, just a quick note you should add a highlighted section of some sort on your proposed resolution to remind people to re-toggle "Auto Updates" once the fix is merged. Choosing to install a specific version inherently disables "Auto Updates" and could cause issues for users in the future. Just a thought.

@naeem76
Copy link

naeem76 commented Nov 13, 2024

I have a project on .NET 7.1 which works fine on Visual Studio, but getting this error when on vscode.
shouldn't it be loading .NET 7 sdk? it is installed

Edit: Downgrade worked.

@nagilson
Copy link
Member

@nagilson Thanks for the response on this, just a quick note you should add a highlighted section of some sort on your proposed resolution to remind people to re-toggle "Auto Updates" once the fix is merged. Choosing to install a specific version inherently disables "Auto Updates" and could cause issues for users in the future. Just a thought.

Great idea, thank you @adrocic.

@nagilson
Copy link
Member

nagilson commented Nov 13, 2024

I have a project on .NET 7.1 which works fine on Visual Studio, but getting this error when on vscode. shouldn't it be loading .NET 7 sdk? it is installed

Edit: Downgrade worked.

This SDK is for C# to run on, not for your project to run on @naeem76.

@nagilson
Copy link
Member

A fix has been released in the C# extension. Updating to the latest version should also now fix this.

@nagilson
Copy link
Member

I'll leave this open for a few days as more people will probably get the old version of C# and hit this issue, but then I will close it. If the new version does not fix it for anyone, they could also report so here.

@dibarbet
Copy link
Member

The versions of the C# extension with the fix are v2.55.29 or v2.56.31 (pre-release)

@nagilson
Copy link
Member

Gonna close this as impact now looks minimal, thanks everyone!

@badsyntax
Copy link

Can confirm latest version fixes this issue for me.

@nagilson nagilson unpinned this issue Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working client:csharp Issues raised by the C# extention(s) or users of that extension. cost: small P0
Projects
None yet
Development

Successfully merging a pull request may close this issue.