Open dtivel opened 8 years ago
Just hit this with nuget.exe 4.9.2.5706 after adding this local package source that accidentally retained protocolVersion="3"
from another line:
<add key="local" value="D:\git\DevCore\bin\Debug\Packages" protocolVersion="3" />
nuget restore C:\Users\andarno\source\repos\SampleServiceHubUser MSBuild auto-detection: using msbuild version '16.1.68.42340' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\bin'. Restoring packages for C:\Users\andarno\source\repos\SampleServiceHubUser\SampleServiceHubUser\SampleServiceHubUser.csproj... Restoring packages for C:\Users\andarno\source\repos\SampleServiceHubUser\EchoService\EchoService.csproj... Object reference not set to an instance of an object.
Note the unhelpful error message. I was only able to determine the root cause being the inappropriate xml attribute after attaching a debugger to nuget.exe and observing first chance exceptions.
I'm encountering this in a private NuGet feed in the Browse tab. On some projects that use packages from that feed, it works just fine. On others it shows just this error.
For my case at least, the private feed contains packages that contain package references to other packages, though those are from other feeds. For example, I have a package called Custom.Package
in my private feed, which contains a reference to Newtonsoft.Json
from NuGet Gallery. The information about where to retrieve the package from is not contained in the package reference, so it has to do guess work and assume that the package is retrievable and it's up to the user to include the necessary package feeds.
On that regard, this shows that the package manager is not quite resilient. One minor inconvenience tears the entire UX apart, and tells the user nothing but a message that the process failed. Ironically, when I build the solution with the proper package sources enabled, it succeeds. It's only the UI that shows that an error occurred while browsing the feed's packages.
At least add the ability to show the full stack trace in the output. This classic null reference error says absolutely nothing other than a middle finger to the user.
Repro steps:
Result:
The visible
NullReferenceException
exception reproes on 3.6.0 beta 1, 3.5.0, 3.4.4, but not 3.3.0.Observation: The
-Source
command line option without the project's NuGet.Config file handles the input more gracefully.