Repository navigation
fix(Linux CI test): Wait for the first canvas paint in Blazor CPU sample tests - #5353
Merged
mattleibow merged 1 commit intoOct 15, 2026
Merged
Conversation
Contributor
📦 Try the packages from this PRWarning Do not run these scripts without first reviewing the code in this PR. Step 1 — Download the packages bash / macOS / Linux: curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 5353PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 5353"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-5353/packages --name skiasharp-pr-5353More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-5353 |
Contributor
|
Hey there @@VirgilMing! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
4 of 14 tasks
VirgilMing
marked this pull request as ready for review
October 14, 2026 16:25
A visible canvas can still be empty while the raster interop module loads. Wait for the sample's first opaque pixel before capturing the existing golden image, and exercise delayed module initialization as a regression. The delayed case fails with the old condition and passes with pixel readiness. Normal initialization, infrastructure/discovery tests, and the unfiltered Console solution pass locally. Related to mono#5312; observed while validating mono#5352. The earliest introduction of the readiness gap is not established by the current refactored-file blame.
VirgilMing
force-pushed
the
dev/issue-5312-blazor-first-paint
branch
from
October 15, 2026 06:56
e20b715 to
2a92af1
Compare
mattleibow
approved these changes
Oct 15, 2026
mattleibow
pushed a commit
that referenced
this pull request
Oct 15, 2026
Build on #5353's pixel readiness fix without a fixed fault-injection delay. Hold raster initialization until the readiness predicate observes a real transparent pixel, then permit painting and retain the full golden comparison. Release pending routes during failure cleanup. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
6 of 14 tasks
mattleibow
added a commit
that referenced
this pull request
Oct 17, 2026
) Stabilize browser sample captures and stable Uno startup (#5361) Context: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1636281 Context: #5353 Context: https://github.com/mono/SkiaSharp/pull/5293/checks?check_run_id=116262705576 Context: unoplatform/uno#24260 Changes: unoplatform/uno@f4d493c...da217df Handle CSS transitions, eventual image readiness, and Uno splash dismissal at their respective boundaries rather than relaxing golden comparisons. Keep the Basic Uno sample on a stable SDK and retain repository mirrors for dependency resolution. ~~ Finish CSS transitions before screenshot capture ~~ The Windows Blazor drawing test cleared its canvas correctly, but its cleared-page screenshot differed by 1906 pixels inside the Clear button. Its hover-exit background transition was still running after the canvas readiness assertions had passed. Set ScreenshotAnimations.Disabled in BrowserRunningApp.Screenshot so Playwright finishes finite CSS transitions during capture. This does not wait for WASM canvas painting. Retain the drawing pixel assertions and existing comparison thresholds; no Blazor references change. Verify the capture behavior with a transition paused halfway: the captured 100x100 swatch must contain its final color, not the intermediate color. ~~ Give eventual image readiness one bounded comparison loop ~~ A visible Blazor CPU canvas can precede its first raster presentation. The pixel-readiness fix in #5353 addressed that gap, but separate pixel and image checks give startup different readiness conditions and deadlines. Add an opt-in SampleImage.Validate capture-delegate overload that returns the matching image path. Retry dimension and pixel mismatches against the reviewed reference, using the existing comparison options. Default to a two-second budget with 100ms polling; the CPU startup test explicitly allows ten seconds and returns on the first matching capture. Replace BlazorWebAssemblyCpuSampleRuns(delayFirstPaint), its one-second module-delay case, and its opaque-pixel probe with a normal startup test using the complete golden image as its readiness condition. Do not apply eventual matching globally to drawing or GPU assertions: a matching frame does not establish that every intermediate frame was correct. Limit each capture await to the remaining budget and test cancellation. WaitAsync stops waiting; it does not cancel the underlying capture. Propagate capture errors and cancellation rather than treating them as image mismatches. Missing references and corrupt images also fail without retrying. Preserve one-shot validation and produce the usual diagnostics when a completed mismatch persists until the deadline. Exercise transient and persistent mismatches, dimension changes, retained diagnostics, invalid deadlines, stalled captures, and error propagation. A browser test captures an incorrect frame followed by the expected frame; the console-error test verifies browser errors still escape through the capture loop. ~~ Adopt stable Uno without accepting unrelated image changes ~~ Update the Basic Uno sample from Uno.Sdk 6.6.0-dev.208 to stable 6.7.30, which selects runtime 6.7.135. Keep repository package sources unchanged: the required dependencies are supplied through the existing mirrors. Add a contract test for the artifacts, dotnet-public, and dotnet-eng source/mapping keys; generated SkiaSharp and HarfBuzzSharp consumers remain restricted to staged artifacts. The newer navigation template changes top-navigation spacing. Review and update the nine Uno references for that layout change: 1556 CPU navigation pixels and 1582 Drawing navigation pixels per reference. Every pixel below the 49-pixel navigation header remains unchanged, including scene content, strokes, the Clear button, and drawing controls. Stable CPU and drawing tests pass these references without changing their tolerances. ~~ Keep recording until Uno dismisses its startup splash ~~ The Windows Uno failure remained on .uno-loader until startup timed out. Reproduce the symptom locally on stable 6.7.30 with 4x Chromium CPU throttling: the loader stays visible for 60 seconds despite an existing canvas and no browser errors. Uno subscribes to CompositionTarget.FrameRendered, then requests a presentation through IXamlRootHost.InvalidateRender. Presentation can reuse an existing recording without raising the event needed to remove the splash. The upstream correction requests a new recorded frame, but that correction is absent from the selected stable runtime. Add a WebAssembly-only partial App hook before window activation. Temporarily subscribe to the public CompositionTarget.Rendering event, whose stable implementation requests recorded frames. Let Uno remove its own loader, then unsubscribe. Also stop on window close. An independent non-repeating 60-second dispatcher timer unsubscribes and reports an explicit error if dismissal never completes. Do not hide the loader or substitute screenshot retries for application recovery. The workaround passed 32 local cold starts, including 20 consecutive 4x-throttled starts. Observation confirmed cleanup after natural dismissal. A fault-injected observer that never reported dismissal triggered the timeout error and stopped observing. These checks support the workaround, not a guarantee over every scheduling interleaving. Retain the existing normal Uno startup, rendering, navigation, drawing, and clear tests without permanent loader-query instrumentation. Remove the workaround when the sample adopts a runtime containing the upstream recorded-frame correction. The final head passes the Windows, Linux, and macOS sample Host and Build checks and both sample Docker checks. Co-authored-by: Matthew Leibowitz <[email protected]> Co-authored-by: Virgil Ming <[email protected]> Co-authored-by: Copilot App <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One liner
This PR fixes a flaky test in GitHub Linux CI pipeline.
Description
The Blazor CPU sample can expose a visible canvas before its raster interop has presented any pixels. Capturing at that point produces an empty drawing area and fails the existing golden-image assertion. This was observed in the Linux Host job of build 1634806 for #5352, with 869,440 of 1,152,000 pixels differing (75.472%).
Wait for the CPU canvas's first opaque pixel before capturing it. This sample paints an opaque background, and the raster view presents the frame in one
putImageDatacall. The existing image comparison still checks the complete rendered scene.Exercise both normal initialization and a regression case that delays the raster interop module by one second; the delay is fault injection in the regression case, while readiness is determined by pixels.
Historical scope:
git blameidentifies the current refactored test's arrival through #5312; it does not establish the earliest introduction of this readiness gap.The same wait-for-visible-then-capture sequence already appears in older revision 9b143bac's BasicSampleTests.cs. Earlier build 1632173 reported four Linux Samples errors, but their contents have not been inspected and are not classified as this blank-canvas failure. The final #5312 and the merged-main Linux Host runs passed. The earliest introduction is not traced here. #5352 is the verified blank-canvas observation; these historical results do not establish its failure rate or exclude an environment-specific trigger.
Related issues
Related to #5312. Observed while validating #5352.
Required skia PR
None.
Areas affected
binding/)externals/skia/src/c,include/c)Changes
None to public API, ABI, or product rendering. The CPU screenshot test waits for an actual frame and covers delayed initialization. Its golden image and strict 0.075% differing-pixel tolerance are retained.
Testing
Local Gentoo/glibc x64, .NET SDK 10.0.401, Playwright 1.55.0, Chromium Headless Shell 140.0.7339.16 (revision 1187). The generated sample consumes the exact
4.156.0-pr.5352.26514.6package cohort from producing build 1634806; the test runner is built from this branch's source.f1e82f7, five fresh runsThe controlled case proves that the missing readiness condition can produce the observed image failure. The original CI run was not instrumented, so its precise timing/environment trigger remains unverified. A preliminary attempt made before browser installation completed reported a missing executable and is excluded from image-failure statistics.
Commands:
The Console solution reused source-built Linux natives and isolated DejaVu font fixtures through Fontconfig, as in the producing local validation. No skip policy was changed.
Unverified: other operating systems and architectures, the full Samples Build/Docker/device/Uno groups, and this branch's remote CI.
Also, Gentoo uses Playwright's Ubuntu 20.04 fallback browser build. Local WASM tools/runtime are 10.0.12, while the producing CI sample used 10.0.6. These differences limit direct inference about production CI frequency.
Checklist
Changesabove lists all public API and behavioral changes///documentation and regenerated bindings when applicable — N/A: test-only changemono/skiaPR linked above and bindings regenerated — N/A: no native or C API change