Repository navigation
Description
Current behavior 🐛
The runtime test Given_RichEditBox.When_Advanced_Math_Layout_Is_Bounded_And_Maps_Scripts (src/Uno.UI.RuntimeTests/Microsoft/UI/Xaml/Controls/Given_RichEditBox.Math.skia.cs) fails intermittently in the WebAssembly Skia Runtime Tests 3 job:
Assert.IsTrue failed. 'condition' expression: 'preSup.Y < baseRect.Y'.
The failing step lays out <mmultiscripts><mi>T</mi><mi>i</mi><mn>2</mn><mprescripts/><mi>j</mi><mn>3</mn></mmultiscripts> and expects the pre-superscript 3 to sit above the base 𝑇. On the failing runs it doesn't. The earlier mover/munder/munderover steps in the same test pass.
Frequency. Measured with Azure DevOps Analytics on 2026-11-03:
- master: failed in 9 of 35 builds from 2026-10-29 to 2026-11-03, about 25%. There were no master failures from early October (the start of Analytics retention) until 2026-10-30, although the test has existed since 2026-07-27 (b2be67e).
- PR builds: about 35 failures over the same window, including PRs unrelated to
RichEditBoxor text. Backports torelease/stable/7.0are affected too. - Each affected build has exactly one failed result for this test, and in every build checked it was the WebAssembly job. The test passes on the Desktop, Android and iOS jobs of the same builds.
- Recent failing master builds: 243473, 243427, 243351, 243072, 243039, 242873, 242505, 242460, 242458.
- Example PR builds: fix: Subscribe to Command.CanExecuteChanged weakly (backport #25965) #26004 (243446), fix(sdk)!: Ship only the WebView2 native loader #25996 (243415), fix(sdk): Report Lottie XAML on WinAppSDK without its package #25987 (243356), fix(progressbar): Port ProgressBar to WinUI 2.5.1 #24563 (243323), fix(NavigationView): Don't root menu items from the SplitView #25968 (243116), fix(xamlgen): Skip ApiExtension registrations of inaccessible types #25905 (242679).
Onset. The first failing master build, 242458, is at 769af4a (2026-10-30). The master merges just before it include #25817 (Keep WASM Arabic fallback in its script's font). Its commit a339542 changes UnicodeText so that a Common or Inherited character stays in the run's fallback font when that font has the glyph. Digits such as the 3 in the failing step are Common-script characters, and the neighbouring 𝑗/𝑇 are mathematical alphanumerics that resolve through a fallback font. This is a hypothesis from timing and code inspection only; it has not been bisected or reproduced locally. If it holds, the flakiness would come from which fallback font has finished loading on WASM when the layout runs.
Expected behavior 🎯
The test passes reliably on WebAssembly, as it does on the other platforms. The pre-superscript should be positioned above the base regardless of font-loading timing.
How to reproduce it (as minimally and precisely as possible) 🔬
CI only so far, in the Tests - WebAssembly / Skia Runtime Tests 3 job, at about 25% per build.
A local attempt would run Given_RichEditBox.When_Advanced_Math_Layout_Is_Bounded_And_Maps_Scripts on the WASM Skia head, repeated with UITEST_RUNTIME_TESTS_ITERATIONS, ideally as part of shard 3 so earlier tests have loaded (or not loaded) the same fonts. Running it before and after a339542 would confirm or rule out the hypothesis above.
Workaround 🛠️
Re-run the failed WebAssembly job. On earlier builds the job passed on re-run (for example 242458, 242679, 243116).
Affected platforms 📱💻🖥️
WebAssembly
Uno.Sdk version (and other relevant versions) 📦
master (CI) since 769af4a, and release/stable/7.0.
IDE version 🧑💻
N/A (CI)
Anything else we need to know? 💬
Tracked alongside the known flaky runtime tests in #9080. Not to be confused with #25600 (the three WebGPU Given_RichEditBox caret/selection/stress tests).
Activity
Xiaoy312 commentedon Nov 4, 2026
Update: root cause found, and it isn't #25817's
UnicodeTextchange. I reproduced the failure deterministically on a local WASM build of current master.Mechanism
On WebAssembly, the font
RichEditBoxuses for math depends on download timing:Lazy<string>(RichEditTextDocument.MathRenderingFontFamilyName).raw.githubusercontent.combecause some earlier text needed it.FontDetailsCachelookup is memoized as well. In the cold run,GetFont("Noto Sans Math", 16)later returnedNoto Monoeven after Noto Sans Math had loaded.So the math layout this test measures depends on whether an earlier test in the shard has finished downloading Noto Sans Math by the time math is first used.
Repro. Three runs of the same mmultiscripts layout, each in a fresh browser session, using a throwaway diagnostic test:
preSup.Yvsbase.YpostSupfails tooTextBlockshowing𝑇ran first (codepoint fallback, as an earlier CI test would)(Local build was
net10.0-browserwasmin Edge; CI runs net11 in Chrome. The logic involved is managed, so that shouldn't matter.)The cold result stays the same after Noto Sans Math finishes downloading in that run: the editor keeps using Open Sans. The isolated CI retry is effectively the cold case, which is why it always passes. In the failing shard-3 runs, every in-process retry fails the same way within ~0.5 s, which fits state left by earlier tests rather than timing inside this test.
Two things to fix
preSup.Y < baseRect.Ycompares the tops of caret/line boxes of different fonts at different scales. With Noto Sans Math, the base's line box is 53.7 px tall at 36 px, so its top sits far above the glyph. The superscript is still raised (its centre is ~9 px above the base's). Comparing baselines or centres would test the intent without depending on font ascent.When_Structured_Math_Layout_Maps_Core_Markersmakes the same comparison formsubsupand could fail the same way once Noto Sans Math is the math font.Correction to the original description: a339542 can't affect this. Its branch needs
currentFontDetails != inline.FontInfo, which a single-token layout never reaches. Why failures start on 2026-10-30 is still unverified. The likeliest explanation is that #25817's other commit (9888593, which changes which fallback families are fetched) changed when Noto Sans Math lands relative to the first math use in shard 3.Xiaoy312 commentedon Nov 4, 2026
Follow-up: what downloads Noto Sans Math in shard 3, and why this started on 2026-10-30.
Trigger. The runtime-test runner shows each test name, with its
DataRowarguments, in its statusTextBlock. In shard 3,Given_CurrencyFormatter.When_FormatDoubleWithSpecialCurrencyCoderuns well beforeGiven_RichEditBox. ItsAEDrow (د.إ.) and then itsBHDrow (د.ب.) make thatTextBlockrequest Arabic letters from the browser fallback service. The coverage table lists the basic Arabic letters (U+0627–U+064A) under both Noto Sans Arabic and Noto Sans Math.The race in
CoverageTableFontFallbackService, since 9888593 (#25817):U+062F(Dal, fromAED) starts the Noto Sans Arabic download.U+0628(Beh, fromBHD) is requested before that download finishes, it is queued for the next batch._fetchedFonts.GetUntriedFamilies(U+0628)finds no untried script font, so it returns the untried symbol font.BuildCoverageMapuses that list, so the batch downloads Noto Sans Math, even though Noto Sans Arabic already covers the letter.MathRenderingFontFamilyNamepicks it, and the test fails as described above.Before 9888593,
BuildCoverageMapread the raw table. The greedy selection then picked Noto Sans Arabic again (it covers more of the batch), so Noto Sans Math was never downloaded on this path. That is the 10-30 onset. I checked this by reading the code, not by running the old code.Why only some builds. In CI the
AED→BHDrows are only 0.16–0.64 s apart, and the Arabic font comes fromraw.githubusercontent.com. Whenever that download takes longer than the gap, the race is hit. I can't measure CI's download times from the logs, so the ~1-in-4 rate is an inference. Locally the rows are about 1 s apart and the download takes about 0.1 s, so a full local run of shard 3 (same test order as CI) passes.Reproduction (local
net10.0-browserwasm, Edge):[Noto Sans Arabic, Noto Sans Math]When_FormatDoubleWithSpecialCurrencyCode+ this test, Arabic download delayed by 1.5 sU+0628,U+062C,U+0645and fetches Noto Sans MathpreSup.Y < baseRect.YFix for the fallback service. Before selecting families for a batch,
FetchFontsForMissingCodepointsshould drop the queued codepoints thatFindFetchedFamilyForCodepointcan now resolve. The first row above can serve as the fail-before test. That stops the unneeded ~1 MB download. On its own it doesn't remove the order dependency described earlier, because any test that shows a real math character before this one would still change which fontRichEditBoxuses for math.test: Compare math script baselines, not box tops