-
Notifications
You must be signed in to change notification settings - Fork 269
Description
When one of the project has a corrupt (or empty) project.json, manage packages for project UI does not load, and manage packages for solution is disabled.
Why?
In:
The solution manager tries to initialize the cache, and if it fails it catches any exception bubbling up and clears the cache. Leading to eventually trying to get NuGet Project from the cache, getting null and failing to load the window with a null ref exception.
The fun continues: in https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Clients/PackageManagement.VisualStudio/IDE/NuGetAndEnvDTEProjectCache.cs#L224
Individual projects are being added, but if one of them fails for any reason the whole operation fails, leading to an empty cache.
In this case the following constructor fails because it can't read the json file
https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Clients/PackageManagement.VisualStudio/VSNuGetProjectFactory.cs#L80
Finally -
This line
https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Clients/VsExtension/NuGetPackage.cs#L642
Returns null leading to
https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Clients/VsExtension/NuGetPackage.cs#L647
Throwing