Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet from within VS fails to update a package if one or more package sources are unavailable #10164

Closed
IanKemp opened this issue Oct 21, 2020 · 1 comment
Labels
Functionality:Restore Functionality:VisualStudioUI Package Manager UI et al Resolution:ByDesign This issue appears to be ByDesign

Comments

@IanKemp
Copy link

IanKemp commented Oct 21, 2020

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): VS UI

NuGet version (x.x.x.xxx): 5.7.0

VS version (if appropriate): VS 2019 Enterprise 16.7.6

OS version (i.e. win10 v1607 (14393.321)): Windows 10 version 2004

Detailed repro steps so we can see the same problem

Have a package from NuGet.org installed in a PackageReference-style .NET Core 3.1 project.
Have NuGet configured for multiple sources, including NuGet.org.
Have one of those sources that is not NuGet.org be unavailable.
Attempt to update a package.

Expected result

The package is updated.

Actual result

NuGet sits for 30 seconds with all its UI elements disabled like it's actually doing something, then re-enables all its UI elements. But the package in question is not updated. You can repeat this as many times as you want and nothing changes (AKA definition of insanity).

The only clue that NuGet is failing at basic functionality is a line in the Output window for Package Manager: The local source 'xxxxxxxxx' doesn't exist. As such I'm guessing it's related to the stupidity that's #7189.

Okay, why can't NuGet check and use the sources that are available? And maybe log a warning saying "skipping source 'xxxxxxxxx' because it cannot be contacted"? You know, sane behaviour that most sane people would expect?

Or if such functionality is too advanced for the NuGet team to implement, perhaps show an error dialog with the message instead of just dumping it to a place where few would think to look. After all, if the program fails to do something, a sane human being would logically expect a reason for that failure to be prominently displayed!

But perhaps I should stop expecting sane behaviour from NuGet. After all, this repo is where bug reports about this product go to die. The only reason I'm writing this is to prevent anyone with the same issue from having to file a bug report with the expectation that said issue will actually be fixed.

@donnie-msft donnie-msft added Functionality:Restore Functionality:VisualStudioUI Package Manager UI et al Resolution:ByDesign This issue appears to be ByDesign labels Oct 22, 2020
@donnie-msft
Copy link
Contributor

I've also found this unintuitive. You need to understand 2 things:

  1. How restore works. Restore always visits all enabled sources to see whether the given packages exists or not. This affects the Restore Graph. See: https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore#package-restore-overview

  2. How VS UI works with package sources. I assume you used the Package Manager Window. If so, know that the dropdown affects the Browse tab packages, not the actions that result in a restore. You need to open the Settings and disable the sources you don't want the Restore to touch. See: https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio#package-sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Restore Functionality:VisualStudioUI Package Manager UI et al Resolution:ByDesign This issue appears to be ByDesign
Projects
None yet
Development

No branches or pull requests

2 participants