Skip to content

Commit be2ce17

Browse files
authored
Merge pull request github#15881 from tamasvajk/buildless/fix-fallback
C#: Deduplicate not yet restored package names
2 parents dddba32 + b07b076 commit be2ce17

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,18 @@ private void DownloadMissingPackages(List<FileInfo> allFiles, ISet<string> dllPa
924924
return;
925925
}
926926

927+
var multipleVersions = notYetDownloadedPackages
928+
.GroupBy(p => p.Name)
929+
.Where(g => g.Count() > 1)
930+
.Select(g => g.Key)
931+
.ToList();
932+
933+
foreach (var package in multipleVersions)
934+
{
935+
logger.LogWarning($"Found multiple not yet restored packages with name '{package}'.");
936+
notYetDownloadedPackages.Remove(new(package, PackageReferenceSource.PackagesConfig));
937+
}
938+
927939
logger.LogInfo($"Found {notYetDownloadedPackages.Count} packages that are not yet restored");
928940

929941
var nugetConfigs = allFiles.SelectFileNamesByName("nuget.config").ToArray();

0 commit comments

Comments
 (0)