Skip to content

fix(sdk)!: Make Skia on WinAppSDK opt-in - #26105

Merged
MartinZikmund merged 4 commits into
masterfrom
dev/mazi/winui-no-skia-default
Nov 7, 2026
Merged

MartinZikmund merged 4 commits into
masterfrom
dev/mazi/winui-no-skia-default

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

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, and Uno.Features.targets mapped that to Skia on every head. That adds SkiaSharp.Views.WinUI and Uno.WinUI.Graphics2DSK on Windows. Trimming removes the managed assemblies, but the natives stay behind with nothing that can load them.

  • Skia is now off on the WinAppSDK target by default, even when UnoFeatures lists it, along with the legacy SkiaRenderer. 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 lists Skia (or, in a head, SkiaRenderer). On its own, the property adds nothing.
  • The SkiaSharp and ANGLE native PDBs are never copied on Windows, opted in or not. They're 226 MB of the 243 MB, and nothing needs them at runtime.

Packages are removed rather than only their assets on purpose. Removing just the natives would leave SKXamlCanvas and ShadowContainer compiling and then failing when they first draw, because they really do use libSkiaSharp on WinUI. This way, the build fails instead.

Breaking change. Code built for Windows that uses SKCanvasElement, SKXamlCanvas, Toolkit Skia controls such as ShadowContainer, 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 the SKCanvasElement docs are updated.

First-party follow-up needed. uno.toolkit.ui's Uno.Toolkit.Skia.WinUI lists Skia and its ShadowContainer uses SKXamlCanvas, 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 list Skia (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 Skia and SkiaRenderer was 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_UnoSdkRendererFeature covers 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 74 Given_UnoSdk* tests pass.

  • Runtime (real publish): blank unoapp -preset blank -platforms windows against dotnet new winui, with Uno.Sdk 7.0.0-dev.161 patched with this change and the CoreLogging fix 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:

    App Publish folder Skia files
    Native WinUI 66.35 MB, 49 files n/a
    Uno, before 310.72 MB, 115 files natives and PDBs
    Uno, after, Skia listed 67.72 MB, 106 files none
    Uno, after, Skia listed with the property 84.70 MB, 111 files natives only

    The same 67.72 MB also came from the template's default SkiaRenderer with an earlier version of this PR. The remaining difference from native is Uno.UI.Extras, icons and small files.

  • Not validated: none of these apps were launched, so SKXamlCanvas drawing 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 ✅

A project that uses Skia types on Windows lists Skia and sets UnoEnableSkiaOnWinAppSdk to true. See the migration guide change in this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TXMNtyBVZWdemP5ouF7UUA

MartinZikmund and others added 2 commits November 5, 2026 15:38
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
Copilot AI balanced review requested due to automatic review settings November 5, 2026 14:45
@github-actions github-actions Bot added area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation labels Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 25s —— View job


Review of #26105: ignore SkiaRenderer on WinAppSDK heads

Verdict: ship, with one suggestion. I found 0 high, 1 medium and 0 low issues.

Code review (by inspection, nothing executed here).

  • The Uno.Features.targets change does what the PR describes.
    • Uno Platform heads still map skiarenderer to skia.
    • Windows heads drop skiarenderer and get no implied skia.
    • An explicit Skia still brings the packages in.
    • Libraries are unchanged. The existing library tests, including the Windows library case, still match the logic.
  • The new tests cover the four Windows head cases in the PR description.
  • The docs are consistent across the four files, including the "doesn't count on Windows" wording in the migration guide.

Not validated.

  • I did not build or run the tests. The runtime and publish numbers in the PR description are the author's.
  • No head using SKCanvasElement was built, as the PR notes.

Cross-cutting.

  • The inline comment is about discoverability. Libraries get UNOB0030 when SkiaRenderer is ignored, but Windows heads get nothing.
  • The PR already flags that it reverses the earlier decision and conflicts with the test in fix(sdk): Ignore SkiaRenderer in WinAppSDK-only libraries #25571. Whoever merges second needs to reconcile that test.
  • The PR title uses fix(sdk)!: and the "NO breaking changes" box is correctly unchecked. That matches Conventional Commits for a breaking change.

<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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 SkiaRenderer mapping to non-WinAppSDK app targets.
  • Adds four MSBuild evaluation cases covering ignored SkiaRenderer and explicit Skia on 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

@unodevops

Copy link
Copy Markdown
Contributor

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

MartinZikmund and others added 2 commits November 5, 2026 16:25
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
Copilot AI balanced review requested due to automatic review settings November 5, 2026 15:26
@MartinZikmund MartinZikmund changed the title fix(sdk)!: Ignore SkiaRenderer on WinAppSDK heads fix(sdk)!: Make Skia on WinAppSDK opt-in Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 25s —— View job


Review of #26105: Skia off on WinAppSDK

Verdict: fix-first. 0 high, 2 medium, 0 low.

Code review (by inspection). I did not build or run any tests.

  • The latest commits go beyond the PR title and description. Skia is now off on Windows even when listed, unless UnoEnableSkiaOnWinAppSdk=true. A target also strips the SkiaSharp native PDBs. The description still says "an explicit Skia still brings the packages in" and that Skia is unchanged for explicit listing. Please update it, and re-check the breaking-change wording and the checklist.
  • One inline comment: the new opt-out is not limited to heads, so libraries with a windows10 TFM also lose an explicit Skia.
  • Not covered by inspection: the earlier reviewer's discoverability suggestion still applies. A Windows head that lists Skia or SkiaRenderer and now gets no packages sees only a compile error. A low-severity message pointing to UnoEnableSkiaOnWinAppSdk would help.
  • The docs (using-the-uno-sdk.md, using-skia-rendering.md, migrating-to-uno-7.md, SKCanvasElement.md) match the new opt-in behavior. UnoEnableSkiaOnWinAppSdk is in the buildschema.
  • _UnoRemoveSkiaNativePdbs in Uno.Common.WinAppSdk.targets runs AfterTargets="ResolvePackageAssets" and drops PDBs from SkiaSharp.NativeAssets.* only. The condition looks right. The new UnoEnableSkiaOnWinAppSdk path and this target are worth a test. I did not check whether the test file covers them.

<_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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Filtering gaps allow duplicate Skia entries to bypass the Windows opt-in and leave runtime-specific Skia/ANGLE PDBs eligible for copying.

2 open issues

Review effort: Balanced

Comment on lines +116 to +117
<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>
@unodevops

Copy link
Copy Markdown
Contributor

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

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund merged commit b324e40 into master Nov 7, 2026
55 of 58 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/winui-no-skia-default branch November 7, 2026 11:46
agneszitte added a commit to unoplatform/uno.toolkit.ui that referenced this pull request Nov 10, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WinAppSDK heads ship ~16 MB of unused Skia/ANGLE native DLLs per architecture

3 participants