Skip to content

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

Merged
MartinZikmund merged 1 commit into
servicing/6.8from
mergify/bp/servicing/6.8/pr-24260
Oct 13, 2026
Merged

MartinZikmund merged 1 commit into
servicing/6.8from
mergify/bp/servicing/6.8/pr-24260

Conversation

@mergify

@mergify mergify Bot commented Oct 10, 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)
@unodevops

Copy link
Copy Markdown
Contributor

@morning4coffe-dev morning4coffe-dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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:

  1. 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.
  2. 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.
  3. 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).

@mergify

mergify Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

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.

@MartinZikmund
MartinZikmund merged commit 324a97b into servicing/6.8 Oct 13, 2026
41 of 42 checks passed
@MartinZikmund
MartinZikmund deleted the mergify/bp/servicing/6.8/pr-24260 branch October 13, 2026 18:10
@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)

4 participants