Repository navigation
Description
Current behavior π
On a Skia Desktop single-project head (net*-desktop), overriding <SkiaSharpVersion> to a version above the one the Uno.Sdk ships does not retarget SkiaSharp.NativeAssets.Linux. The managed SkiaSharp assembly and the Win32/macOS native assets move to the requested version, but the Linux native libSkiaSharp.so stays at the lower version that the Uno.WinUI.Runtime.Skia.X11 / Uno.WinUI.Runtime.Skia.Linux.FrameBuffer runtime packs reference as a floor.
Because managed and native SkiaSharp must match, the app crashes at startup on Linux (native/managed ABI mismatch). There is no build or restore warning β the failure is silent until runtime, and only on Linux (Windows and macOS self-align).
The docs (Using the Skia Desktop β "Upgrading to a later version of SkiaSharp") state that setting SkiaSharpVersion retargets "the SkiaSharp packages the Uno.Sdk manages, including the platform native-asset packages β¦ in one place" β but this is not true for the Linux native asset.
Root cause
- The base
SkiaSharpNuGet package auto-depends onSkiaSharp.NativeAssets.Win32andSkiaSharp.NativeAssets.macOS(in every desktop/generic TFM group, at its own managed version), but has no dependency onSkiaSharp.NativeAssets.Linuxin any group. So bumping managedSkiaSharpself-aligns Win32/macOS native, but never Linux β Linux native assets are opt-in by SkiaSharp's design. - The Uno.Sdk injects
SkiaSharp.NativeAssets.Linuxas an implicit top-level reference only for the legacy*.Skia.Linux.FrameBuffermulti-head, not for the modern single-project desktop head. For that head the only reference to it is the transitive>= <floor>dependency from the X11 / FrameBuffer runtime packs, which NuGet happily satisfies with the floor version (no conflict β no diagnostic). SkiaSharpVersionretargets implicit references, but sinceSkiaSharp.NativeAssets.Linuxis never injected for the desktop head, the property (and the documentedPackageReference Updatefallback) has nothing to bind to β the transitive floor wins.
Expected behavior π―
Setting <SkiaSharpVersion> on a Skia Desktop head retargets all managed and native SkiaSharp packages, including SkiaSharp.NativeAssets.Linux, so managed and native stay aligned on every desktop RID. Moving to SkiaSharp 4 (4.148.0) should work from the single SkiaSharpVersion property, as documented.
How to reproduce it (as minimally and precisely as possible) π¬
Minimal, SkiaSharp-only repro (no full app required) that shows the NuGet-resolution outcome β repro.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Uno.WinUI.Runtime.Skia.X11" Version="6.5.237" />
<PackageReference Include="SkiaSharp" Version="4.148.0" />
</ItemGroup>
</Project>dotnet restore
dotnet list package --include-transitive
Resolved versions:
| Package | Resolved |
|---|---|
| SkiaSharp | 4.148.0 |
| SkiaSharp.NativeAssets.Win32 | 4.148.0 |
| SkiaSharp.NativeAssets.macOS | 4.148.0 |
| SkiaSharp.NativeAssets.Linux | 3.119.0 β stuck at the X11 pack floor |
Restore completes with no NU1605/NU1608 warning or error. In a real Skia Desktop app this ships a 3.119.0 libSkiaSharp.so alongside a 4.148.0 managed SkiaSharp, crashing on Linux at startup.
Full-app path: dotnet new unoapp, set <SkiaSharpVersion>4.148.0</SkiaSharpVersion>, run on Linux/X11 β startup crash; Windows and macOS are unaffected.
Workaround π οΈ
Explicitly reference the Linux native asset at the same version as managed SkiaSharp so it gets a top-level constraint:
<PropertyGroup>
<SkiaSharpVersion>4.148.0</SkiaSharpVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="$(SkiaSharpVersion)" />
</ItemGroup>Under Central Package Management (without transitive pinning) add a direct PackageReference Include in the head plus a matching PackageVersion β a PackageVersion / Update alone is inert against a transitive-only reference.
Renderer π¨
Skia
Affected platforms π±π»π₯οΈ
Desktop (X11), Desktop (Linux Framebuffer)
Uno.Sdk version (and other relevant versions) π¦
Reproduced with public stable Uno.WinUI.Runtime.Skia.X11 6.5.237; the gap is present on master, 6.6 and 6.5.
Anything else we need to know? π¬
Related latent gap (not yet triggered): HarfBuzzSharp.NativeAssets.Linux is referenced by the same runtime packs via the same floor mechanism and would show the identical issue if a consumer overrides the HarfBuzzSharp version above Uno's floor. The WebAssembly native asset is structurally similar (managed SkiaSharp has no wasm dependency), though it links statically at publish so it may surface as a link/AOT failure rather than a startup crash. A focused fix for the Linux SkiaSharp native asset is proposed in the linked PR; the HarfBuzz/WASM siblings can be tracked as follow-ups.
Activity
test(sdk): guard SkiaSharp Linux native alignment in CI
fix(sdk): align Linux SkiaSharp native asset on desktop
chore(build): Bump SkiaSharp to 4.151.1
fix(build): Align SkiaSharp versions in add-ins
fix(build): Compare resolved SkiaSharp versions in the Linux guard