-
Notifications
You must be signed in to change notification settings - Fork 695
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
Log when Restore gets an HTTP 404 for a version when the package is listed on the feed #5845
Conversation
Thanks a lot, @donnie-msft, for helping with the testing. I was not sure how to reproduce |
@@ -91,6 +91,7 @@ public static class ResolverUtility | |||
Strings.Error_PackageNotFoundWhenExpected, | |||
match.Provider.Source, | |||
ex.PackageIdentity.ToString()); | |||
context.Logger.LogError(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to @nkolev92 for providing pointers to the code in NuGet/Home#13460 (comment). The detailed information really helped to understand the root cause of the bug.
There was one statement in that linked comment that I thought I could explain here:
Not sure why InvalidCacheProtocolException in particular gets ignored.
From what I understand, looking at the code, InvalidCacheProtocolException is ignored here because the caller ResolverUtility.FindLibraryEntryAsync
has logic to try downloading the package twice. The first time when PackageNotFoundProtocolException is thrown, the code in the first catch block at the caller invalidates the cache and does a retry. That's why the exception is not logged at the callee but instead logged at the caller.
Hence, in this PR, the exception is logged to the logger at the caller in the second catch block that handles the PackageNotFoundProtocolException
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is missing a log code.
It should've probably been NU1301 like the other ones, or potentially a new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it more, this scenario is distinct enough, where I think it could use a separate code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with minor suggestion about test name.
test/NuGet.Core.Tests/NuGet.DependencyResolver.Core.Tests/FindPackageTests.cs
Outdated
Show resolved
Hide resolved
f8a6d84
Bug
Fixes: NuGet/Home#13460
Regression? Last working version:
Description
I've tested Kartheek's branch, and since he's got higher priority issues right now, wanted to create the PR on his behalf.
What I've found is that, Azure DevOps (ADO) with upstream sources can return a 404 (not a 401) when a package exists but ADO permissions are not granted to the user to save the requested package version to the local feed.
My testing shows adding this simple logging is extremely useful as it provides a message to help a customer diagnose where the feed failed to find a package.
Normal verbosity
With normal verbosity,
Old behavior:
MSB4181: The "Restore Task" task returned false but did not log an error.
New behavior :
Detailed verbosity
With detailed verbosity, the error message is shown immediately after the full URL.
PR Checklist
PR has a meaningful title
PR has a linked issue.
Described changes
Tests
Documentation