Repository navigation
fix(sdk)!: Make Skia on WinAppSDK opt-in - #26105
Conversation
The blank template lists SkiaRenderer, so every Windows head got the SkiaSharp and ANGLE natives (17 MB, plus 226 MB of PDBs in the publish folder) even though WinUI renders it. An explicit Skia feature still brings them. BREAKING CHANGE: a Windows head using SKCanvasElement, SKXamlCanvas or Toolkit Skia controls now lists Skia instead of relying on SkiaRenderer. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNtyBVZWdemP5ouF7UUA
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNtyBVZWdemP5ouF7UUA
|
Claude finished @MartinZikmund's task in 25s —— View job Review of #26105: ignore
|
| <UnoFeatures Condition="'$(IsUnoHead)' == 'true'">$(UnoFeatures.Replace(';skiarenderer;', ';skia;'))</UnoFeatures> | ||
| <UnoFeatures Condition="'$(IsUnoHead)' != 'true'">$(UnoFeatures.Replace(';skiarenderer;', ';'))</UnoFeatures> | ||
| <UnoFeatures Condition="'$(IsUnoHead)' == 'true' And !$(TargetFramework.Contains('windows10'))">$(UnoFeatures.Replace(';skiarenderer;', ';skia;'))</UnoFeatures> | ||
| <UnoFeatures>$(UnoFeatures.Replace(';skiarenderer;', ';'))</UnoFeatures> |
There was a problem hiding this comment.
Medium – silent drop of SkiaRenderer on Windows heads. Libraries get UNOB0030 when SkiaRenderer is ignored (_UnoLibrarySkiaRendererIgnored, line 22/33), but a Windows head now drops it with no diagnostic. The only symptom for an affected app is a compile error on SKCanvasElement/SKXamlCanvas/ShadowContainer, which doesn't point to UnoFeatures. Since this is a breaking change, consider a low-severity message or warning (a variant of UNOB0030, with a docs entry) when a WinAppSDK head lists SkiaRenderer, telling the user to add Skia if they need Skia types. Use a Message rather than a warning if you don't want to hit templates that still list SkiaRenderer.
If you add it, add a test next to When_Compiling_Then_An_Ignored_SkiaRenderer_Is_Reported in Given_UnoSdkRendererFeature.cs.
There was a problem hiding this comment.
🔵 Needs a closer look
The deliberate Windows-head compatibility break requires maintainer sign-off, and the explicit-Skia migration has not been compile-validated in a consuming head using Skia controls.
No open issues 🎉
What changed in this PR
Addresses #24576 by ignoring the legacy SkiaRenderer feature on Windows (WinAppSDK) heads, avoiding unused SkiaSharp and ANGLE dependencies in default apps. Uno Platform targets remain unchanged; Windows heads needing Skia references must explicitly list Skia.
Changes:
- Restricts legacy
SkiaRenderermapping to non-WinAppSDK app targets. - Adds four MSBuild evaluation cases covering ignored
SkiaRendererand explicitSkiaon Windows. - Updates SDK, rendering, diagnostic, and migration documentation for the breaking change.
| File | Description |
|---|---|
src/Uno.Sdk/targets/Uno.Features.targets |
Stops mapping SkiaRenderer to Skia on WinAppSDK heads. |
src/SourceGenerators/Uno.UI.Tasks.Tests/Given_UnoSdkRendererFeature.cs |
Tests Windows feature normalization and package references. |
doc/articles/uno-build-error-codes.md |
Clarifies the scope of legacy renderer mapping. |
doc/articles/migrating-to-uno-7.md |
Documents the explicit Skia requirement on Windows. |
doc/articles/features/using-the-uno-sdk.md |
Updates the Skia feature’s Windows behavior. |
doc/articles/features/using-skia-rendering.md |
Clarifies that Windows ignores SkiaRenderer. |
Review effort: Balanced
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
Skia is now off on the WinAppSDK target even when listed, unless UnoEnableSkiaOnWinAppSdk is true. Removing the packages rather than only their natives makes code that really uses them fail at build time instead of when it first draws. The native PDBs are dropped either way, as nothing needs them at runtime. BREAKING CHANGE: code built for Windows that uses SKCanvasElement, SKXamlCanvas, Toolkit Skia controls or SkiaSharp through these features must set UnoEnableSkiaOnWinAppSdk to true. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNtyBVZWdemP5ouF7UUA
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNtyBVZWdemP5ouF7UUA
|
Claude finished @MartinZikmund's task in 25s —— View job Review of #26105: Skia off on WinAppSDKVerdict: fix-first. 0 high, 2 medium, 0 low. Code review (by inspection). I did not build or run any tests.
|
| <_UnoSkiaOffOnWinAppSdk Condition="$(TargetFramework.Contains('windows10')) And '$(UnoEnableSkiaOnWinAppSdk)' != 'true'">true</_UnoSkiaOffOnWinAppSdk> | ||
| <UnoFeatures Condition="'$(IsUnoHead)' == 'true' And '$(_UnoSkiaOffOnWinAppSdk)' != 'true'">$(UnoFeatures.Replace(';skiarenderer;', ';skia;'))</UnoFeatures> | ||
| <UnoFeatures>$(UnoFeatures.Replace(';skiarenderer;', ';'))</UnoFeatures> | ||
| <UnoFeatures Condition="'$(_UnoSkiaOffOnWinAppSdk)' == 'true'">$(UnoFeatures.Replace(';skia;', ';'))</UnoFeatures> |
There was a problem hiding this comment.
Medium – the new opt-out also strips an explicit Skia from libraries. _UnoSkiaOffOnWinAppSdk (line 23) is not gated on IsUnoHead, so a multi-targeted library that lists Skia and builds a windows10 TFM now loses Uno.WinUI.Graphics2DSK/Uno.Toolkit.Skia.WinUI there. The PR description and the migration notes only discuss heads, and say an explicit Skia still brings the packages in. That is no longer true after commit 6730052. Libraries are told to list Skia to use SKCanvasElement, so their Windows TFM would now fail to compile unless every consumer sets UnoEnableSkiaOnWinAppSdk. Either scope this to heads ('$(IsUnoHead)' == 'true'), or document and test the library case. The tests added for Windows cover heads only.
| <NativeCopyLocalItems Remove="@(NativeCopyLocalItems)" | ||
| Condition="'%(Extension)' == '.pdb' And $([System.String]::Copy('%(NuGetPackageId)').StartsWith('SkiaSharp.NativeAssets.'))" /> |
| <_UnoSkiaOffOnWinAppSdk Condition="$(TargetFramework.Contains('windows10')) And '$(UnoEnableSkiaOnWinAppSdk)' != 'true'">true</_UnoSkiaOffOnWinAppSdk> | ||
| <UnoFeatures Condition="'$(IsUnoHead)' == 'true' And '$(_UnoSkiaOffOnWinAppSdk)' != 'true'">$(UnoFeatures.Replace(';skiarenderer;', ';skia;'))</UnoFeatures> | ||
| <UnoFeatures>$(UnoFeatures.Replace(';skiarenderer;', ';'))</UnoFeatures> | ||
| <UnoFeatures Condition="'$(_UnoSkiaOffOnWinAppSdk)' == 'true'">$(UnoFeatures.Replace(';skia;', ';'))</UnoFeatures> |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-26105/docs/index.html |
Uno 7.0 turns the Skia feature off on Windows (WinAppSDK) unless the project sets UnoEnableSkiaOnWinAppSdk (unoplatform/uno#26105), so the Windows target lost SkiaSharp and failed with CS0246. ShadowContainer draws with SkiaSharp on Windows too.

GitHub Issue: closes #24576
PR Type:
🐞 Bugfix
What changed? 🚀
Every Windows (WinAppSDK) head from the blank template ships SkiaSharp and ANGLE even though WinUI renders it. The template lists
SkiaRenderer, andUno.Features.targetsmapped that toSkiaon every head. That addsSkiaSharp.Views.WinUIandUno.WinUI.Graphics2DSKon Windows. Trimming removes the managed assemblies, but the natives stay behind with nothing that can load them.Skiais now off on the WinAppSDK target by default, even whenUnoFeatureslists it, along with the legacySkiaRenderer. That covers heads and libraries: no Skia packages, no native libraries. Uno Platform targets are unchanged.<UnoEnableSkiaOnWinAppSdk>true</UnoEnableSkiaOnWinAppSdk>turns it back on for a project that listsSkia(or, in a head,SkiaRenderer). On its own, the property adds nothing.Packages are removed rather than only their assets on purpose. Removing just the natives would leave
SKXamlCanvasandShadowContainercompiling and then failing when they first draw, because they really do uselibSkiaSharpon WinUI. This way, the build fails instead.Breaking change. Code built for Windows that uses
SKCanvasElement,SKXamlCanvas, Toolkit Skia controls such asShadowContainer, or SkiaSharp through these features now fails to compile until the project sets the property. Projects that reference SkiaSharp packages themselves aren't affected by the feature change. The migration guide, the SDK docs, the Skia docs and theSKCanvasElementdocs are updated.First-party follow-up needed.
uno.toolkit.ui'sUno.Toolkit.Skia.WinUIlistsSkiaand itsShadowContainerusesSKXamlCanvas, so its Windows build needs the property, and apps using it on Windows do too. An SDK that doesn't know the property ignores it, so the Toolkit can set it before this ships. I haven't gone through other repos that listSkia(Uno.Gallery, uno.chefs, Uno.Samples and others came up in a search), so some of them may also need it.This reverses an earlier decision. Windows keeping Skia through
SkiaandSkiaRendererwas deliberate, so that shared code compiles (see the test in #25571, which would need to change if it lands after this).Validation.
Runtime (MSBuild evaluation):
Given_UnoSdkRendererFeaturecovers heads and libraries, with and without the property, the property with no feature listed, and removal of only the Skia PDBs. Before the change, 6 of its cases failed. With it, all 74Given_UnoSdk*tests pass.Runtime (real publish): blank
unoapp -preset blank -platforms windowsagainstdotnet new winui, with Uno.Sdk7.0.0-dev.161patched with this change and theCoreLoggingfix from fix(sdk): Pin CoreLogging to the stable 5.0.0 uno.templates#2395. Both on net10.0, Windows App SDK 2.5.1, win-x64, Release, trimmed + R2R, without bundling the Windows App SDK:SkialistedSkialisted with the propertyThe same 67.72 MB also came from the template's default
SkiaRendererwith an earlier version of this PR. The remaining difference from native isUno.UI.Extras, icons and small files.Not validated: none of these apps were launched, so
SKXamlCanvasdrawing with the property set is untested. I measured publish folders rather than MSIX packages. I also didn't build a project that uses these types, or build the Toolkit against this.PR Checklist ✅
Screenshots Compare Test Runresults.: not applicableA project that uses Skia types on Windows lists
Skiaand setsUnoEnableSkiaOnWinAppSdktotrue. See the migration guide change in this PR.🤖 Generated with Claude Code
https://claude.ai/code/session_01TXMNtyBVZWdemP5ouF7UUA