Skip to content

fix(sdk)!: Imply Skia only on app heads - #25614

Merged
Xiaoy312 merged 7 commits into
masterfrom
dev/xygu/20261020/dont-imply-skia-on-libs
Oct 26, 2026
Merged

Xiaoy312 merged 7 commits into
masterfrom
dev/xygu/20261020/dont-imply-skia-on-libs

Conversation

@Xiaoy312

Copy link
Copy Markdown
Contributor

GitHub Issue: closes unoplatform/uno-private#2471

PR Type:

🐞 Bugfix

What changed? 🚀

The Uno.Sdk implied the Skia feature on libraries as well as on apps, and mapped the legacy SkiaRenderer feature (which the unolib template lists by default) to Skia there too. So every packed library depended on Uno.WinUI.Composition.Skia and Uno.WinUI.Graphics2DSK, and through them on SkiaSharp. The library's generated GlobalStaticResources also referenced Uno.WinUI.Graphics2DSK. Every app using such a library got SkiaSharp, including a WebGPU-only app, which is meant to be SkiaSharp-free. Uno.WindowsCommunityToolkit#248, Uno.ColorCode-Universal#15 and Uno.XamlBehaviors#40 each worked around it by removing the packages in their own build.

  • The renderer is the app's choice (Uno.Features.targets). Only an app (IsUnoHead) implies Skia or maps SkiaRenderer to it. A library that draws with SkiaSharp (SKCanvasElement, the SkiaExtensions conversions, the Uno Toolkit's Skia controls) lists Skia, and then gets the same packages as before.
  • UNOB0030 is reported while a library lists SkiaRenderer, since it no longer does anything there. The first sign would otherwise be a missing-type error on SKCanvasElement. It can be silenced with NoWarn.
  • Docs: the 7.0 migration guide (new breaking-change row, the stale skiarenderer passages, the checklist, and which projects the SDK treats as apps), the Uno.Sdk features table, the Skia rendering page, SKCanvasElement, and UNOB0030 in the build error codes.
  • Tests: dotnet msbuild launching in Uno.UI.Tasks.Tests is now one shared helper with a time limit, instead of four copies.

Scope. This fixes libraries that don't list Skia. A library that does list it still depends on SkiaSharp, which is intended, and its DLL still references Uno.WinUI.Graphics2DSK through the generated GlobalStaticResources chaining, whether or not it uses it. That part is in the XAML generator and is tracked in #25612.

Overlap with #25571. It edits the same lines of Uno.Features.targets. This PR already covers its SkiaRenderer case for WinAppSDK-only libraries, and for every library target framework. Its fix for single-targeted WinAppSDK projects (IsWinAppSdk) is separate. Whichever PR lands second has to keep the IsUnoHead guard. The WinAppSDK rows in Given_UnoSdkRendererFeature catch it if it doesn't.

Validation
  • Given_UnoSdkRendererFeature (Uno.UI.Tasks.Tests, 22 cases) evaluates the in-repo SDK targets for libraries and apps across net10.0, -desktop, -android and WinAppSDK, and checks the resolved UnoFeatures, the final PackageReference items and UNOB0030. 7 cases fail against master's targets. The rest of the suite is unchanged.
  • Pack, with a real library. The published Uno.Sdk 7.0.0-dev.83 has the same Uno.Features.targets as master. I repacked it as-is and with this branch's file, then packed a net10.0;net10.0-desktop library that lists SkiaRenderer and has one XAML file:
    • before: the nuspec depends on Uno.WinUI, Uno.WinUI.Composition.Skia and Uno.WinUI.Graphics2DSK, and the DLL references Uno.WinUI.Graphics2DSK
    • after: it depends on Uno.WinUI only, the DLL has no Skia reference, and UNOB0030 is reported
  • A WebGPU-only app over a library that names no renderer (same two SDKs, -desktop, Release):
    • before: the output has Uno.UI.Composition.Skia.dll, Uno.WinUI.Graphics2DSK.dll, SkiaSharp.dll and libSkiaSharp.dll
    • after: it has none of them, and webgpu.dll still ships
  • New template-test row (run-netcore-mobile-template-tests.ps1, uno53AppWithLib with a head-only UnoHeadFeaturesOverride=WebGpu) asserts that same absence on CI.

Breaking change (7.0). A library that uses SKCanvasElement, the SkiaExtensions conversions or Toolkit's Skia controls through the implied Skia feature, or through SkiaRenderer, has to list Skia. UNOB0030 and the migration guide say so. Apps on the Uno.Sdk are unchanged. Follow-ups outside this repo: the unolib template can drop SkiaRenderer, and the three downstream workarounds can go once those repos build against an SDK with this change.

PR Checklist ✅

🤖 Generated with Claude Code

@github-actions github-actions Bot added area/solution-templates Categorizes an issue or PR as relevant to the solution template area/code-generation Categorizes an issue or PR as relevant to code generation area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation labels Oct 21, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20261020/dont-imply-skia-on-libs branch from 65a5f47 to 72185a0 Compare October 22, 2026 19:08
Xiaoy312 and others added 7 commits October 22, 2026 15:18
Three tests each spawned dotnet msbuild with their own copy of the same
code, with no time limit. The shared runner bounds the run, keeps the
first-run banner off stdout, and doesn't let a locked scratch folder
hide a test's own failure.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The renderer is the app's choice, but a library also got the implied
'skia' feature, or 'skia' through the legacy 'SkiaRenderer' token that
the library template lists. Its package then depended on
Uno.WinUI.Composition.Skia and Uno.WinUI.Graphics2DSK, and the generated
GlobalStaticResources referenced Graphics2DSK, so every app using it got
SkiaSharp, a WebGPU-only one included.

Only heads (IsUnoHead) now imply 'skia' or map 'SkiaRenderer' to it. A
library that draws with SkiaSharp (SKCanvasElement, Toolkit Skia
controls) lists 'Skia'.

Related to unoplatform/uno-private#2471

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A library now ignores the legacy SkiaRenderer feature, which the library
template lists by default. A library that draws with SkiaSharp then fails
to compile with no hint that the fix is to list Skia, so report UNOB0030
while a library lists SkiaRenderer.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The template app takes the same features as its library, so no case
could give the head a renderer the library doesn't name. Add a
head-only override and check that a WebGPU-only head over a library
that names no renderer ships no Skia assembly, managed or native.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Uno.Features.targets tested IsWinAppSdk, which Uno.IsPlatform.props
sets before the project body, so it was not set when TargetFramework
came from the body. A single-targeted Windows head then got 'skia'
implied, with Uno.WinUI.Graphics2DSK and SkiaSharp.Views.WinUI, and
'webgpucanvas' added 'webgpu'. Test the target framework directly.

Reported in #25570.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20261020/dont-imply-skia-on-libs branch from 72185a0 to 96f3902 Compare October 22, 2026 19:19
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 240861 has failed on Uno.UI - CI.

@mergify

mergify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@Xiaoy312
Xiaoy312 merged commit 087aea2 into master Oct 26, 2026
58 checks passed
@Xiaoy312
Xiaoy312 deleted the dev/xygu/20261020/dont-imply-skia-on-libs branch October 26, 2026 15:58
@Xiaoy312 Xiaoy312 mentioned this pull request Oct 28, 2026
3 of 5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure area/code-generation Categorizes an issue or PR as relevant to code generation area/solution-templates Categorizes an issue or PR as relevant to the solution template kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants