Fallback from unsupported netcoreapp assets in nugetfuzz

When a package only offers a newer netcoreapp asset than the available stable Microsoft.NETCore.App.Ref package, nugetfuzz cannot build a reference set for that asset. Prefer the net48 asset when one is available so the package can still be included in a corpus sweep.

Assisted-by: OpenCode:openai/gpt-5.5:OpenCode
This commit is contained in:
Siegfried Pammer
2026-10-11 14:20:24 +02:00
parent b4ebe5c79e
commit d74e246e90
+21
View File
@@ -230,6 +230,16 @@ async Task ProcessPackage(string spec)
matchTarget = net48;
pick = PickLib(dir, matchTarget);
}
else if (await ShouldPreferNetFxAsset(pick.Value.fw))
{
var netFxPick = PickLib(dir, net48);
if (netFxPick != null)
{
Console.WriteLine($" ! ref pack {NetCoreRefPack}: nothing published for {pick.Value.fw.Version}, using {netFxPick.Value.fw.GetShortFolderName()} instead of {pick.Value.fw.GetShortFolderName()}");
matchTarget = net48;
pick = netFxPick;
}
}
if (pick == null)
{
Console.WriteLine(" no compatible lib assemblies, skipping");
@@ -336,6 +346,17 @@ async Task<List<string>> CollectDependencies(string rootDir, NuGetFramework matc
return null;
}
async Task<bool> ShouldPreferNetFxAsset(NuGetFramework libFw)
{
if (libFw.Framework != FrameworkConstants.FrameworkIdentifiers.NetCoreApp)
return false;
var versions = await GetVersions(NetCoreRefPack);
if (versions == null)
return true;
return !versions.Any(v => !v.IsPrerelease && v.Major == libFw.Version.Major && v.Minor == libFw.Version.Minor)
&& !versions.Any(v => !v.IsPrerelease && v.Major <= libFw.Version.Major);
}
// Classic .NET Framework has no reference assemblies on this machine; fetch the
// matching Microsoft.NETFramework.ReferenceAssemblies package instead.
async Task<List<string>> GetNetFxRefDirs(NuGetFramework libFw)