Repository navigation
Description
Current behavior 🐛
On feature/breakingchanges, the Microsoft.UI.Composition / RedirectVisual sample in the SamplesApp is broken in two independent ways on Skia (reproduced on Skia Desktop/Win32 and reported in the browser):
-
A
RedirectVisualnever repaints. The redirected column is blank when the sample opens. It only appears after something forces a full repaint (resizing/maximizing the window), and once shown it is frozen on that one frame — aRedirectVisualmirroring an animatingAnimatedVisualPlayershows a stale frame forever.Root cause:
RedirectVisual.CanPaint()delegates to itsSource, but an element's visual is normally a plainContainerVisualthat leaves the painting to its children, so the redirect reports that it paints nothing.Visual.TryGetLocalContentBoundsthen sizes its content to an empty rect,TryGetPaintDamageRegionbails, and no damage is ever reported for the region the redirect draws into. This is latent onmastertoo, where an unclipped Lottie render surface happened to over-damage the whole frame and masked it; the portedAnimatedVisualPlayernow clips its animated visual, so the frame is no longer over-damaged and the defect became visible. -
A Lottie animation paints on an opaque box.
AnimatedVisualPlayerbacked byLottieVisualSourceclears its canvas to transparent insideSKCanvasElement.RenderOverride. That canvas is the frame being recorded, not a private surface, soSKCanvas.Clear(Src blend) punches the animation's box straight through everything painted behind the player — it renders black on Win32 and white in a browser (the page behind the canvas), instead of letting the app background show through.
Expected behavior 🎯
- A
RedirectVisualrepaints its own region every frame, so it mirrors its source live without needing a window resize. - A Lottie animation composites over whatever is painted behind the player; transparent parts of the animation show the app background.
How to reproduce it (as minimally and precisely as possible) 🔬
- Build and run the SamplesApp on Skia from
feature/breakingchanges:
dotnet run --project src/SamplesApp/SamplesApp.Skia.Generic -- "sample=Microsoft.UI.Composition/RedirectVisual" - Observe the "RedirectVisual" column: it is empty.
- Resize/maximize the window: the column appears, but the mirrored
AnimatedVisualPlayerstays on a single frame while the source keeps animating. - Observe the squirrel animation in the "Source" column: it is drawn on a solid opaque rectangle instead of the app background.
Minimal form of (1) without Lottie:
var compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;
var redirect = compositor.CreateRedirectVisual(ElementCompositionPreview.GetElementVisual(source));
redirect.Size = new(100, 100);
ElementCompositionPreview.SetElementChildVisual(host, redirect);
// `host` stays blank until the window is resized.Workaround 🛠️
For (1), forcing a full repaint (resizing the window) shows the redirected content once. There is no workaround for keeping it live.
For (2), none.
Renderer 🎨
- Skia
- Native
Affected platforms 📱💻🖥️
WebAssembly, Desktop (Windows), Desktop (macOS), Desktop (X11) — everything using the Skia compositor.
Uno.Sdk version (and other relevant versions) 📦
Source build of the feature/breakingchanges branch (Uno 7.0 development). Not present on master.
Anything else we need to know? 💬
Both defects are covered by new runtime tests:
Given_Visual_Damage.When_RedirectVisual_Repaints_Then_Its_Own_Region_Is_DamagedGiven_AnimatedVisualPlayer.When_Production_Lottie_Source_Renders_Then_Content_Behind_It_Is_Preserved
Activity
ramezgerges commentedon Oct 30, 2026
Both defects are fixed on master (which now contains
feature/breakingchanges):RedirectVisual.CanPaint()is nowSource is not nullinstead of delegating to the source visual, which is usually aContainerVisualthat paints nothing itself, so the redirect's region is damaged every frame.Clears the recorded frame, so it composites over whatever is behind the player.Validation (Skia Desktop, master
d980de546a): the two runtime tests from this issue pass:Given_Visual_Damage.When_RedirectVisual_Repaints_Then_Its_Own_Region_Is_DamagedGiven_AnimatedVisualPlayer.When_Production_Lottie_Source_Renders_Then_Content_Behind_It_Is_PreservedClosing as fixed.
khaskoul commentedon Nov 14, 2026
Verified fixed on Uno.Sdk 7.0.22 (Uno.WinUI 7.0.65) and 7.1.0-dev.18 (Uno.WinUI 7.1.0-dev.173), both parts, same result on both.
Environment: Windows 11 Pro (26200), .NET SDK 10.0.401, Skia desktop (Win32), Release, 150% scale.
Repro: page Background Orange; an AnimatedVisualPlayer (200x200) with a LottieVisualSource playing a transparent composition with a moving blue circle; next to it an empty Canvas hosting
CreateRedirectVisual(GetElementVisual(player)), Size 200x200, set in Loaded.