From d74e246e90683e60db0ec00453bd6ffb96a6cfb8 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 11 Oct 2026 14:20:24 +0200 Subject: [PATCH] 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 --- TestTools/nugetfuzz.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/TestTools/nugetfuzz.cs b/TestTools/nugetfuzz.cs index bc89964d7..5481ec344 100644 --- a/TestTools/nugetfuzz.cs +++ b/TestTools/nugetfuzz.cs @@ -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> CollectDependencies(string rootDir, NuGetFramework matc return null; } +async Task 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> GetNetFxRefDirs(NuGetFramework libFw)