Skip to content

Fix race condition in PEInterface build and improve icon loading#4810

Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
fix/peinterface-parallel-build-graph
May 21, 2026
Merged

Fix race condition in PEInterface build and improve icon loading#4810
Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
fix/peinterface-parallel-build-graph

Conversation

@GabrielDuf
Copy link
Copy Markdown
Contributor

Summary

Two unrelated-but-small fixes to the Avalonia build & UI that surfaced during day-to-day work on UniGetUI.Avalonia.slnx:

  1. CS0006 race when building UniGetUI.PackageEngine.PEInterface in parallel IDEs

Building UniGetUI.Avalonia.slnx from a clean state in Rider (and presumably VS)intermittently fails with errors like: CSC: Error CS0006 : Metadata file '…\UniGetUI.PackageEngine.Managers.Chocolatey\obj\x64\Debug\net10.0-windows10.0.26100.0\ref\UniGetUI.PackageEngine.Managers.Chocolatey.dll' could not be found

  1. ArgumentException: Unable to load bitmap from provided data spam when searching packages

Typing in the package search bar produced a flood of caught-but-logged exceptions in Rider:
System.ArgumentException: Unable to load bitmap from provided data at Avalonia.Skia.ImmutableBitmap..ctor(Stream stream)

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.
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.
@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit 7ddeb48 into main May 21, 2026
3 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the fix/peinterface-parallel-build-graph branch May 21, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants