Skip to content

SkiaSharpVersion override does not retarget SkiaSharp.NativeAssets.Linux on Skia Desktop (managed/native mismatch β†’ startup crash)Β #23658

Closed

Description

@MartinZikmund

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 SkiaSharp NuGet package auto-depends on SkiaSharp.NativeAssets.Win32 and SkiaSharp.NativeAssets.macOS (in every desktop/generic TFM group, at its own managed version), but has no dependency on SkiaSharp.NativeAssets.Linux in any group. So bumping managed SkiaSharp self-aligns Win32/macOS native, but never Linux β€” Linux native assets are opt-in by SkiaSharp's design.
  • The Uno.Sdk injects SkiaSharp.NativeAssets.Linux as an implicit top-level reference only for the legacy *.Skia.Linux.FrameBuffer multi-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).
  • SkiaSharpVersion retargets implicit references, but since SkiaSharp.NativeAssets.Linux is never injected for the desktop head, the property (and the documented PackageReference Update fallback) 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

  1. self-assigned this
    on Jul 6, 2026
  2. added
    kind/bug
    triage/untriaged
    on Jul 6, 2026
  3. added theissue type on Jul 6, 2026
  4. added a commit that references this issue on Jul 6, 2026
    a973552
  5. removed
    kind/bug
    triage/untriaged
    on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions