C#: Improve BMN feed checking & handling. - #21684
Merged
michaelnebel merged 33 commits intoApr 30, 2026
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR we make some improvements to the C# NuGet feed check and use of private registries.
The primary change(s) in this PR
dotnet restore(both for projects and solutions) which overrides the use ofnuget.configfiles (unless NuGet feed reachability check is disabled and no private registries are configured). For both explicit and implicit feeds, we only use the feeds that we can successfully connect to (there is still an envionment variable that makes it possible to override the feed check for a list of feeds - and then they will be included no matter what). However, this is still a significant change in the semantics of the dependency resolution. Previously, we used all feeds and letdotnet restoresort out issues with the feeds. However, it turns out that it might cause a significant slowdown to the restore process, if we use feeds that eg. issues 401/403 responses.nuget.configfiles in the repository (including environment specific nuget configuration). The list is created per project/solution to correctly as possible reflect the sources intended for use by a specific project/solution.dotnet restoreto make sure that we include the private registries.All NuGet feeds reachable. Previously, we only considered a feed to be unreachable in case there was a timeout. Now other errors like 401/403 are included.standalone_dependencies_nuget_config_errorare expected. As the feed in thenuget.configis it not reachable it means thatAll NuGet feeds reachableis false (and thus0is reported).Failed project restore with package source erroris now0as the restore process now excludes the unreachable feed from thenuget.configfile (and instead we get another NuGet error as the restore process attempts to find theNewtonSoft.Jsonpackage in theemptyfolder).The fallback in case there is a timeout on an explicit feed has been kept in the implementation. I think we should consider removing this fallback (it was made prior to any of the logic, which overrides the
nuget.configfiles) and just rely on supplying the reachable feeds to thedotnet restoreprocess.The documentation for the
-s(NuGet source) can be seen here.I encourage to review all the changes in this PR in one go (review by commit is NOT encouraged as there is some going back and forth due to experimentation).
DCA looks good; For our existing suite there doesn't appear to be any regressions. However, I expect improved performance in cases where there are issues with connecting to the feeds.