@@ -214,7 +214,7 @@ private List<string> GetReachableFallbackNugetFeeds(HashSet<string>? feedsFromNu
214214
215215 logger . LogInfo ( $ "Checking fallback NuGet feed reachability on feeds: { string . Join ( ", " , fallbackFeeds . OrderBy ( f => f ) ) } ") ;
216216 var ( initialTimeout , tryCount ) = GetFeedRequestSettings ( isFallback : true ) ;
217- var reachableFallbackFeeds = fallbackFeeds . Where ( feed => IsFeedReachable ( feed , initialTimeout , tryCount , allowExceptions : false ) ) . ToList ( ) ;
217+ var reachableFallbackFeeds = fallbackFeeds . Where ( feed => IsFeedReachable ( feed , initialTimeout , tryCount ) ) . ToList ( ) ;
218218 if ( reachableFallbackFeeds . Count == 0 )
219219 {
220220 logger . LogWarning ( "No fallback NuGet feeds are reachable." ) ;
@@ -280,14 +280,18 @@ private void RestoreProjects(IEnumerable<string> projects, HashSet<string>? conf
280280 // `nuget.config` files instead of the command-line arguments.
281281 string ? extraArgs = null ;
282282
283- if ( this . dependabotProxy is not null )
283+ if ( dependabotProxy is not null )
284284 {
285285 // If the Dependabot proxy is configured, then our main goal is to make `dotnet` aware
286286 // of the private registry feeds. However, since providing them as command-line arguments
287287 // to `dotnet` ignores other feeds that may be configured, we also need to add the feeds
288288 // we have discovered from analysing `nuget.config` files.
289289 var sources = configuredSources ?? new ( ) ;
290- this . dependabotProxy . RegistryURLs . ForEach ( url => sources . Add ( url ) ) ;
290+ dependabotProxy . RegistryURLs . ForEach ( url =>
291+ {
292+ logger . LogDebug ( $ "Adding feed from Dependabot proxy configuration: { url } ") ;
293+ sources . Add ( url ) ;
294+ } ) ;
291295
292296 // Add package sources. If any are present, they override all sources specified in
293297 // the configuration file(s).
@@ -628,7 +632,7 @@ private static async Task<HttpResponseMessage> ExecuteGetRequest(string address,
628632 return await httpClient . GetAsync ( address , cancellationToken ) ;
629633 }
630634
631- private bool IsFeedReachable ( string feed , int timeoutMilliSeconds , int tryCount , bool allowExceptions = true )
635+ private bool IsFeedReachable ( string feed , int timeoutMilliSeconds , int tryCount )
632636 {
633637 logger . LogInfo ( $ "Checking if NuGet feed '{ feed } ' is reachable...") ;
634638
@@ -682,18 +686,10 @@ private bool IsFeedReachable(string feed, int timeoutMilliSeconds, int tryCount,
682686 timeoutMilliSeconds *= 2 ;
683687 continue ;
684688 }
685- if ( exc is HttpRequestException hre &&
686- hre . StatusCode == HttpStatusCode . Unauthorized )
687- {
688-
689- logger . LogInfo ( $ "Received 401 Unauthorized error from NuGet feed '{ feed } '.") ;
690- return false ;
691- }
692689
693- // We're only interested in timeouts.
694- var start = allowExceptions ? "Considering" : "Not considering" ;
695- logger . LogInfo ( $ "Querying NuGet feed '{ feed } ' failed in a timely manner. { start } the feed for use. The reason for the failure: { exc . Message } ") ;
696- return allowExceptions ;
690+ // The feed is not reachable.
691+ logger . LogInfo ( $ "Querying NuGet feed '{ feed } ' failed. Not considering the feed for use. The reason for the failure: { exc . Message } ") ;
692+ return false ;
697693 }
698694 }
699695
@@ -734,9 +730,9 @@ private bool CheckFeeds(out HashSet<string> explicitFeeds, out HashSet<string> a
734730
735731 // If private package registries are configured for C#, then check those
736732 // in addition to the ones that are configured in `nuget.config` files.
737- this . dependabotProxy ? . RegistryURLs . ForEach ( url => feedsToCheck . Add ( url ) ) ;
733+ dependabotProxy ? . RegistryURLs . ForEach ( url => feedsToCheck . Add ( url ) ) ;
738734
739- var allFeedsReachable = this . CheckSpecifiedFeeds ( feedsToCheck ) ;
735+ var allFeedsReachable = CheckSpecifiedFeeds ( feedsToCheck ) ;
740736
741737 var inheritedFeeds = allFeeds . Except ( explicitFeeds ) . ToHashSet ( ) ;
742738 if ( inheritedFeeds . Count > 0 )
0 commit comments