NuGet / Home

Repo for NuGet Client issues

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Package Manager UI fails to load with a NRE due to restore errors

nkolev92 opened this issue · comments

Affected Branch: main
Affected Build: Version 17.12.0 Preview 1.0 [35110.85.main]
Affected Product Language: English/All

Steps to reproduce:

  1. Construct a package using Central Package Management but miss a PackageVersion for one of the PackageReference items

  2. Open in Visual Studio

  3. Solution Explorer -> Right click on Solution node -> Manage Nuget Packages for Solution...

  4. Displayed yellow bar for "Error Occurred"
    a84f0746-a42c-4932-9edf-b8b7f3b6fdc8

  5. Click on "Show Errors in Output"
    RESULT:
    d589c0b5-b09a-496a-869d-53eda3f23316

EXPECT:

I see errors in several places in this condition, but for all of them, they say "Value cannot be null, Parameter name: versionRange". If they included what package was the issue, then I can track it down. In fact, because the version is empty/null/not displayed, the only piece of information I have to track this down is the packageName. If it had a version and the version was simply not valid SemVer or not found in a source, I could look at the small set of packages with that version to find the cause.

NOTE
There is a warning in the Error List:
Severity Code Description Project File Line Suppression State Details
Error NU1010 The PackageReference items Microsoft.VisualStudio.Editor do not have corresponding PackageVersion. EntityDesigner D:\dd\ef6tools\src\EFTools\EntityDesignEntityDesigner\EntityDesigner.csproj 1

But the link in the UI brings me to the Package Manager Output window, which doesn't have such a clear message.

I also have this error after converting to Central Package References:
image

By conversion, I mean the following:

  • Removed all version numbers from PackageReference elements in project files (*.csproj).
  • Added PackageVersion elements to Directory.Packages.props located in root directory of solution.

I've double-checked that all PackageReference elements present in any project file have a corresponding PackageVersion element in Directory.Packages.props.

I also get an error in the error list, but no project name/path mentioned there:
image

If I try to restore the Nuget Packages for the solution, I get a few errors like this one:
The PackageReference items Microsoft.Graph;Microsoft.Identity.Client do not have corresponding PackageVersion.
But the corresponding PackageVersion elements are present in Directory.Packages.props.

Visual Studio Professional 2022 (64bit), Version 17.10.0

Never mind - I was actually checking/editing the wrong Directory.Packages.props in a different working copy. The relevant one was actually missing some PackageVersion elements.

Time to have a break, I guess.