NuGet / Home

Repo for NuGet Client issues
Other
1.49k stars 252 forks source link

LINQ exception (Value cannot be null. Parameter name: source) thrown in VS when NuGet Restore is disabled #13722

Open donnie-msft opened 4 weeks ago

donnie-msft commented 4 weeks ago

NuGet Product Used

Visual Studio Package Management UI

Product Version

Version 17.12.0 Preview 2.0 [35218.33.main]

Worked before?

No response

Impact

It bothers me. A fix would be nice

Repro Steps & Context

My nuget.config had restore disabled:

  <packageRestore>
    <add key="enabled" value="false" />
    <add key="automatic" value="True" />
  </packageRestore>

When I opened a new VSIX Project in VS and tried opening NuGet PM UI, I was faced with a cryptic error below caused by GetInstalledAndTransitivePackagesAsync: Error: Value cannot be null. Parameter name: source image

With some debugging, I found this LINQ error when trying to access installed transitive packages: image

It would be better for customers to show a specific message indicating that Restore is disabled, rather than breaking LINQ extension methods with a null collection.

Verbose Logs

No response

SueSu01 commented 3 weeks ago

@donnie-msft For IOS project, a cryptic error occurs when opening the PM UI after creating the IOS project, regardless of whether restore is disabled. a. Open PM UI and enable the restore and click restore button, the package restore completes, but the cryptic error still remains. image

b. Open PM UI and disable the restore and click restore button, with the expected “NuGet restore is currently disabled” error and cryptic error still remains. image