Skip to content

Commit 73ca2eb

Browse files
committed
C#: Use allFeeds rather than explicitFeeds for RestoreProjects
1 parent 4d3b024 commit 73ca2eb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@ public HashSet<AssemblyLookupLocation> Restore()
103103
compilationInfoContainer.CompilationInfos.Add(("NuGet feed responsiveness checked", checkNugetFeedResponsiveness ? "1" : "0"));
104104

105105
HashSet<string>? explicitFeeds = null;
106+
HashSet<string>? allFeeds = null;
106107

107108
try
108109
{
109-
if (checkNugetFeedResponsiveness && !CheckFeeds(out explicitFeeds))
110+
if (checkNugetFeedResponsiveness && !CheckFeeds(out explicitFeeds, out allFeeds))
110111
{
111112
// 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.
112113
var unresponsiveMissingPackageLocation = DownloadMissingPackagesFromSpecificFeeds(explicitFeeds);
@@ -156,7 +157,7 @@ public HashSet<AssemblyLookupLocation> Restore()
156157

157158
var restoredProjects = RestoreSolutions(out var container);
158159
var projects = fileProvider.Projects.Except(restoredProjects);
159-
RestoreProjects(projects, explicitFeeds, out var containers);
160+
RestoreProjects(projects, allFeeds, out var containers);
160161

161162
var dependencies = containers.Flatten(container);
162163

@@ -704,10 +705,11 @@ private bool IsFeedReachable(string feed, int timeoutMilliSeconds, int tryCount,
704705
/// as well as any private package registry feeds that are configured.
705706
/// </summary>
706707
/// <param name="explicitFeeds">Outputs the set of explicit feeds.</param>
708+
/// <param name="allFeeds">Outputs the set of all feeds (explicit and inherited).</param>
707709
/// <returns>True if all feeds are reachable or false otherwise.</returns>
708-
private bool CheckFeeds(out HashSet<string> explicitFeeds)
710+
private bool CheckFeeds(out HashSet<string> explicitFeeds, out HashSet<string> allFeeds)
709711
{
710-
(explicitFeeds, var allFeeds) = GetAllFeeds();
712+
(explicitFeeds, allFeeds) = GetAllFeeds();
711713
HashSet<string> feedsToCheck = explicitFeeds;
712714

713715
// If private package registries are configured for C#, then check those

0 commit comments

Comments
 (0)