NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 253 forks source link

Improve the error experience when the reading of the runtime.json fails due to a malformed file #8203

Closed nkolev92 closed 3 years ago

nkolev92 commented 5 years ago

Right now that will lead to an error like the following:

C:\Program Files\dotnet\sdk\3.0.100-preview5-011568\NuGet.targets(121,5): error : After parsing a value an unexpected character was encountered: ". Path 'alpine-x64-corert.#import', line 24, position 4. [F:\test\7351\7351.csproj]

To repro this:

Create a project, and add runtime identifiers and run restore. To provide a bad runtime json, either:

  1. Redirect to a custom global packages folder and make edits to microsoft.netcore.platforms in a breaking way (you might need to disable the fallback folder otherwise NuGet will never download it).
  2. Create your own package with a runtime.json.

Found while working on https://github.com/NuGet/Home/issues/7351.

Note that this has been an issue for a very long time and we have heard no reports whatsoever. Mostly because no one really authors runtime.json that frequently :)

nkolev92 commented 3 years ago

Closing as low pri