@@ -110,48 +110,47 @@ public HashSet<AssemblyLookupLocation> Restore()
110110 logger . LogInfo ( $ "Checking NuGet feed responsiveness: { feedManager . CheckNugetFeedResponsiveness } ") ;
111111 compilationInfoContainer . CompilationInfos . Add ( ( "NuGet feed responsiveness checked" , feedManager . CheckNugetFeedResponsiveness ? "1" : "0" ) ) ;
112112
113- HashSet < string > explicitFeeds = [ ] ;
114113 HashSet < string > reachableFeeds = [ ] ;
115114
116- try
117- {
118- EmitNugetConfigDiagnostics ( ) ;
115+ EmitNugetConfigDiagnostics ( ) ;
119116
120- // Find feeds that are configured in NuGet.config files and divide them into ones that
121- // are explicitly configured for the project or by a private registry, and "all feeds"
122- // (including inherited ones) from other locations on the host outside of the working directory.
123- ( explicitFeeds , var allFeeds ) = feedManager . GetAllFeeds ( ) ;
124-
125- if ( feedManager . CheckNugetFeedResponsiveness )
126- {
127- var inheritedFeeds = allFeeds . Except ( explicitFeeds ) . ToHashSet ( ) ;
117+ // Find feeds that are configured in NuGet.config files and divide them into ones that
118+ // are explicitly configured for the project or by a private registry, and "all feeds"
119+ // (including inherited ones) from other locations on the host outside of the working directory.
120+ ( var explicitFeeds , var allFeeds ) = feedManager . GetAllFeeds ( ) ;
128121
129- if ( inheritedFeeds . Count > 0 )
130- {
131- compilationInfoContainer . CompilationInfos . Add ( ( "Inherited NuGet feed count" , inheritedFeeds . Count . ToString ( ) ) ) ;
132- }
122+ if ( feedManager . CheckNugetFeedResponsiveness )
123+ {
124+ var inheritedFeeds = allFeeds . Except ( explicitFeeds ) . ToHashSet ( ) ;
133125
134- var timeout = feedManager . CheckSpecifiedFeeds ( explicitFeeds , out var reachableExplicitFeeds ) ;
135- reachableFeeds . UnionWith ( reachableExplicitFeeds ) ;
126+ if ( inheritedFeeds . Count > 0 )
127+ {
128+ compilationInfoContainer . CompilationInfos . Add ( ( "Inherited NuGet feed count" , inheritedFeeds . Count . ToString ( ) ) ) ;
129+ }
136130
137- var allExplicitReachable = explicitFeeds . Count == reachableExplicitFeeds . Count ;
138- EmitUnreachableFeedsDiagnostics ( allExplicitReachable ) ;
131+ var timeout = feedManager . CheckSpecifiedFeeds ( explicitFeeds , out var reachableExplicitFeeds ) ;
132+ reachableFeeds . UnionWith ( reachableExplicitFeeds ) ;
139133
140- if ( timeout )
141- {
142- // If we experience a timeout, we use this fallback.
143- // todo: we could also check the reachability of the inherited nuget feeds, but to use those in the fallback we would need to handle authentication too.
144- var unresponsiveMissingPackageLocation = DownloadMissingPackagesFromSpecificFeeds ( [ ] , explicitFeeds ) ;
145- return unresponsiveMissingPackageLocation is null
146- ? [ ]
147- : [ unresponsiveMissingPackageLocation ] ;
148- }
134+ var allExplicitReachable = explicitFeeds . Count == reachableExplicitFeeds . Count ;
135+ EmitUnreachableFeedsDiagnostics ( allExplicitReachable ) ;
149136
150- // Inherited feeds should only be used, if they are indeed reachable (as they may be environment specific).
151- feedManager . CheckSpecifiedFeeds ( inheritedFeeds , out var reachableInheritedFeeds ) ;
152- reachableFeeds . UnionWith ( reachableInheritedFeeds ) ;
137+ if ( timeout )
138+ {
139+ // If we experience a timeout, we use this fallback.
140+ // todo: we could also check the reachability of the inherited nuget feeds, but to use those in the fallback we would need to handle authentication too.
141+ var unresponsiveMissingPackageLocation = DownloadMissingPackagesFromSpecificFeeds ( [ ] , explicitFeeds ) ;
142+ return unresponsiveMissingPackageLocation is null
143+ ? [ ]
144+ : [ unresponsiveMissingPackageLocation ] ;
153145 }
154146
147+ // Inherited feeds should only be used, if they are indeed reachable (as they may be environment specific).
148+ feedManager . CheckSpecifiedFeeds ( inheritedFeeds , out var reachableInheritedFeeds ) ;
149+ reachableFeeds . UnionWith ( reachableInheritedFeeds ) ;
150+ }
151+
152+ try
153+ {
155154 using ( var packagesConfigRestore = PackagesConfigRestoreFactory . Create ( fileProvider , legacyPackageDirectory , logger , feedManager . IsDefaultFeedReachable ) )
156155 {
157156 var count = packagesConfigRestore . InstallPackages ( ) ;
0 commit comments