Repository navigation
fix(wasm): Request a record so the splash is removed (backport #24260) - #25172
Conversation
ShowCore waits for CompositionTarget.FrameRendered, which is raised only from the record pass, but asked for it with IXamlRootHost.InvalidateRender - a present request that never sets RenderRequested. When the target has already painted ahead of time, the resulting tick records nothing, the event never fires, and the bootstrap loader stays up forever. Route the request through ICompositionTarget.RequestNewFrame, whose every state converges on a Render, so FrameRendered is guaranteed after the handler subscribes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Up3PthZrnrxxYK2g8NVgWD (cherry picked from commit 9656bf8)
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25172/wasm-skia-net9/index.html |
morning4coffe-dev
left a comment
There was a problem hiding this comment.
Verified: the backport is a faithful copy of master's #24260. The 6.8 head blob for WebAssemblyWindowWrapper.cs (890a46166c9a) is identical to the blob master produced for the same file, the one-file diff matches master's hunk line for line, and ICompositionTarget.RequestNewFrame exists on servicing/6.8 (CompositionTarget.RenderScheduling.skia.cs:86). Root cause checked against the 6.8 render state machine: InvalidateRender only reaches BrowserRenderer.InvalidateRender (present), and RequestNewFrame is the path that sets RenderRequested or the post-ahead-of-time flag.
Findings, by severity:
- Medium: no regression test for the fixed invariant. The PR body says a deterministic test needs a seam to put the target into _renderedAheadOfTime when ShowCore subscribes, and defers it to a follow-up. The repo's bug-fix rule asks for a test that fails before and passes after where feasible. The seam may not exist yet, so this is a request, not a blocker, but the follow-up should be tracked.
- Low: the validation evidence is author-reported and the author says it is not statistically meaningful (1 stuck in 32 before, 0 in 24 after). The case rests on one captured device instance plus the state-machine analysis. Label it as such in the PR and do not treat the 0/24 result as evidence.
- Info: the code comment at WebAssemblyWindowWrapper.cs:161-165 cites #23586 and is identical to master. No other concerns in the diff.
CI (statusCheckRollup): all build, runtime and snapshot checks SUCCESS. Codacy Static Code Analysis is ACTION_REQUIRED (details not inspected). Uno.UI - docs is NEUTRAL. The review check is SKIPPED.
Not validated by me: no build, no test run, no device run. Checked by code review and by comparing blob hashes with master. I did not check the Codacy findings.
Verdict: COMMENT (only because of the missing regression test and the author-reported evidence; the code itself is correct and faithful).
|
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. |
GitHub Issue: closes #23586
PR Type:
🐞 Bugfix
What changed? 🚀
WASM Skia apps intermittently stay on the bootstrap loading screen. The app is fully running — and, as it turns out, fully rendered: hiding the loader on a stuck device reveals a correctly laid out, painted app underneath. Only the splash removal never happens. Tapping the screen recovers it.
WebAssemblyWindowWrapper.ShowCorewaits forCompositionTarget.FrameRendered, which is raised from exactly one place — the end ofCompositionTarget.Render(), i.e. the record pass. But to trigger it, it called((IXamlRootHost)host).InvalidateRender(), which only asks for a present. That never setsRenderRequested, andEnqueueRenderCallbackonly reachesRender()through that flag:So when the target has already painted ahead of time — the normal state once the tree has settled, which is exactly where
ShowCore's continuation runs after the font preload — the requested tick consumes_renderedAheadOfTime, records nothing, andFrameRenderedis never raised. The one-shot subscription waits forever and the loader is never removed. BecausePersistBootstrapperLoader()disables the bootstrapper's own removal, there is no timeout or fallback.This also explains the recovery asymmetry: a tap dirties the tree, which forces a record and fires the event, while a resize whose canvas dimensions are unchanged only produces a present and leaves the app stuck.
The fix routes the request through the API that actually marks the target as needing a record:
All three states in
RequestNewFrameconverge on a subsequentRender(), soFrameRenderedis guaranteed to be raised after the handler subscribes.Note this is a different defect from the one addressed by #23590 (which re-armed a dropped
requestAnimationFrame). That fix was correct as far as it went, but the render pump was not the remaining problem —requestAnimationFrameis verifiably alive and firing in ~3 ms in the stuck state, and the frame had already been produced.Validation
What is proven. On a physical device (Samsung SM-F966B, Android 16, Edge 151) driven over USB via the
DevTools protocol, a stuck instance was captured and inspected live:
requestAnimationFramefiring normally (3 ms),document.visibilityState: visible.uno-loaderrevealed the app fully rendered underneath — correct layout, text and listSo the frame exists and the render pump is healthy; only the splash removal never happens. That rules out
a dropped
requestAnimationFrameas the remaining cause and points at theFrameRenderedsubscription,which the state machine above shows cannot be guaranteed by
InvalidateRender(). The recovery asymmetrycorroborates it: a tap dirties the tree and forces a record (recovers), while a synthetic
resizewithunchanged canvas dimensions produces only a present (does not recover).
What is not proven. The hang is rare enough that I could not demonstrate the fix statistically. Using a
harness that reloads the app against a deliberately slowed origin (40 ms per asset) and checks whether
.uno-loaderclears, the observed rate was 1 stuck in 32 runs (~3%) before the fix and 0 in 24 runsafter. At a 3% rate, 0-in-24 would occur ~48% of the time by chance, so the post-fix run is not evidence
of anything on its own. The case for this change rests on the captured stuck instance and the state
machine, not on that comparison.
A deterministic regression test is the right follow-up: it needs a seam to put the target into
_renderedAheadOfTimeat the moment the handler subscribes, then assert thatFrameRenderedis stillraised. Happy to add that here or separately.
PR Checklist ✅
_renderedAheadOfTimestate at the momentShowCoresubscribes; happy to add that as a follow-up if wanted.Screenshots Compare Test Runresults.This is an automatic backport of pull request #24260 done by [Mergify](https://mergify.com).