From 271ac3e38dc7a79ffd9afdf58ae98bdc5766f794 Mon Sep 17 00:00:00 2001 From: GabrielDuf Date: Thu, 21 May 2026 14:03:11 -0400 Subject: [PATCH 1/2] Fix CS0006 race in PEInterface multi-target build Conditional ItemGroups on $(TargetFramework) hid manager ProjectReferences from the outer multi-target evaluation (where $(TargetFramework) is empty), so parallel IDE schedulers (Rider, VS) could start PEInterface's inner builds before Chocolatey/PowerShell/Scoop/WinGet (or Apt/Dnf/Pacman/etc.) finished, producing CS0006 "metadata file ... could not be found" errors. Declare every manager ProjectReference unconditionally so the project graph is correct. Use ReferenceOutputAssembly metadata to scope which TFM actually consumes which assembly, and SetTargetFramework to pin Windows-only managers (single-TFM) when consumed from the net10.0 inner build. The set of /reference assemblies passed to csc and the bin/ output per TFM are unchanged. --- .../UniGetUI.PackageEngine.PEInterface.csproj | 55 ++++++++++++++----- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/src/UniGetUI.PackageEngine.PackageEngine/UniGetUI.PackageEngine.PEInterface.csproj b/src/UniGetUI.PackageEngine.PackageEngine/UniGetUI.PackageEngine.PEInterface.csproj index ccfcb2527..c614e9d7d 100644 --- a/src/UniGetUI.PackageEngine.PackageEngine/UniGetUI.PackageEngine.PEInterface.csproj +++ b/src/UniGetUI.PackageEngine.PackageEngine/UniGetUI.PackageEngine.PEInterface.csproj @@ -24,20 +24,49 @@ - - - - - + + + + false + + + false + + + false + + + false + - - - - - - - + + + + false + + + false + + + false + + + false + + + false + + + false + @@ -47,4 +76,4 @@ - + \ No newline at end of file From e35963e24de248bc2e119a12f19c69795818ec62 Mon Sep 17 00:00:00 2001 From: GabrielDuf Date: Thu, 21 May 2026 14:09:36 -0400 Subject: [PATCH 2/2] Skip unsupported icon formats in PackageWrapper.LoadIconAsync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The icon cache (IconCacheEngine.MimeToExtension) writes files in formats Avalonia's Skia Bitmap cannot decode: SVG, AVIF, ICO, TIFF. Passing such a file to `new Bitmap(uri.LocalPath)` throws ArgumentException("Unable to load bitmap from provided data"). The exception is caught and the failure is cached, but Rider's debugger surfaces every first-chance throw, so users see a flood of stack traces whenever the package list brings new rows with non-raster icons into view (e.g. after typing in the search bar). Whitelist PNG/JPEG/GIF/BMP/WebP — the formats Skia can actually decode — and short-circuit unsupported extensions to a cached-null result. The package falls back to its manager source icon, same as before. --- .../Models/PackageCollections.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/UniGetUI.Avalonia/Models/PackageCollections.cs b/src/UniGetUI.Avalonia/Models/PackageCollections.cs index 125c99342..597d48a8f 100644 --- a/src/UniGetUI.Avalonia/Models/PackageCollections.cs +++ b/src/UniGetUI.Avalonia/Models/PackageCollections.cs @@ -201,6 +201,13 @@ private async Task LoadIconAsync() if (uri.IsFile) { + if (!IsSkiaDecodableExtension(uri.LocalPath)) + { + // Avalonia's Bitmap (Skia) can't decode SVG/AVIF/ICO/TIFF — the + // icon cache may produce those. Reject upfront so we don't throw. + _iconCache[hash] = null; + return; + } bitmap = await Task.Run(() => new Bitmap(uri.LocalPath)).ConfigureAwait(false); } else if (uri.Scheme is "http" or "https") @@ -223,6 +230,17 @@ private async Task LoadIconAsync() catch { _iconCache[hash] = null; } } + private static bool IsSkiaDecodableExtension(string path) + { + string ext = Path.GetExtension(path); + return ext.Equals(".png", StringComparison.OrdinalIgnoreCase) + || ext.Equals(".jpg", StringComparison.OrdinalIgnoreCase) + || ext.Equals(".jpeg", StringComparison.OrdinalIgnoreCase) + || ext.Equals(".gif", StringComparison.OrdinalIgnoreCase) + || ext.Equals(".bmp", StringComparison.OrdinalIgnoreCase) + || ext.Equals(".webp", StringComparison.OrdinalIgnoreCase); + } + private void Package_PropertyChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(Package.Tag))