Skip to content

fix(wasm): Request a record so the splash is removed (backport #24260) - #25767

Merged
agneszitte merged 1 commit into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24260
Oct 27, 2026
Merged

agneszitte merged 1 commit into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24260

Conversation

@mergify

@mergify mergify Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

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.ShowCore waits for CompositionTarget.FrameRendered, which is raised from exactly one place — the end of CompositionTarget.Render(), i.e. the record pass. But to trigger it, it called ((IXamlRootHost)host).InvalidateRender(), which only asks for a present. That never sets RenderRequested, and EnqueueRenderCallback only reaches Render() through that flag:

if (_renderedAheadOfTime)
{
    _renderedAheadOfTime = false;
    if (_renderRequestedAfterAheadOfTimePaint) { /* reschedule */ }
    else { /* nothing — no Render(), so no FrameRendered */ }
}
else if (RenderRequested)
{
    RenderRequested = false;
    Render();                 // the only path that raises FrameRendered
}

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, and FrameRendered is never raised. The one-shot subscription waits forever and the loader is never removed. Because PersistBootstrapperLoader() 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:

((ICompositionTarget)compositionTarget).RequestNewFrame();

All three states in RequestNewFrame converge on a subsequent Render(), so FrameRendered is 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 — requestAnimationFrame is 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:

  • requestAnimationFrame firing normally (3 ms), document.visibilityState: visible
  • .NET runtime fully booted, heap at 386 MB; canvas correctly sized at 1080x2082
  • hiding .uno-loader revealed the app fully rendered underneath — correct layout, text and list

So the frame exists and the render pump is healthy; only the splash removal never happens. That rules out
a dropped requestAnimationFrame as the remaining cause and points at the FrameRendered subscription,
which the state machine above shows cannot be guaranteed by InvalidateRender(). The recovery asymmetry
corroborates it: a tap dirties the tree and forces a record (recovers), while a synthetic resize with
unchanged 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-loader clears, the observed rate was 1 stuck in 32 runs (~3%) before the fix and 0 in 24 runs
after
. 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
_renderedAheadOfTime at the moment the handler subscribes, then assert that FrameRendered is still
raised. Happy to add that here or separately.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable)
    • No automated test: the failure is a startup timing race in the WASM host, reachable only from a real browser boot. Validated with the device harness described above. A deterministic test would need a seam to force the _renderedAheadOfTime state at the moment ShowCore subscribes; happy to add that as a follow-up if wanted.
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features)
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

This is an automatic backport of pull request #24260 done by [Mergify](https://mergify.com).

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)
@agneszitte
agneszitte merged commit a446efc into release/stable/6.7 Oct 27, 2026
10 of 17 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.7/pr-24260 branch October 27, 2026 23:39
@agneszitte agneszitte linked an issue Oct 27, 2026 that may be closed by this pull request
1 of 2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WASM Skia] Apps don't start rending app on mobile ("stays" rendering loading page)

2 participants