Skip to content

Stabilize browser screenshots and stable Uno startup in sample CI - #5361

Merged
mattleibow merged 14 commits into
mainfrom
mattleibow-browser-screenshot-synchronization
Oct 17, 2026
Merged

mattleibow merged 14 commits into
mainfrom
mattleibow-browser-screenshot-synchronization

Conversation

@mattleibow

@mattleibow mattleibow commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Stabilize browser samples without changing comparison tolerances or adding package-feed exceptions.

  • Finish CSS transitions during golden captures. The Windows Clear-button mismatch in build 1636281 was reproduced with the sample's hover-exit transition; its canvas was already correct.
  • Add an opt-in SampleImage.Validate(Func<Task<string>>, ...) capture loop. The Blazor CPU test uses one 10-second deadline to wait for the complete expected image, replacing the separate pixel probe. Retry dimension/pixel mismatches only. Missing references, corrupt images, capture/browser errors and cancellation are not retried. Persistent mismatches retain diagnostics and fail. No reference-capture bypass.
  • Keep stable Uno SDK 6.7.30 and work around its splash-dismissal race by temporarily subscribing to CompositionTarget.Rendering before window activation. Stop after Uno removes its own loader, on window close, or with an explicit error at the 60-second safety limit. This requests recorded frames through the public event; it does not hide/remove the splash. Upstream fix: unoplatform/uno#24260.

The stable Uno hang was reproduced locally at 4x Chromium CPU throttling. The workaround passed 32 cold starts, including 20 consecutive 4x starts; observation confirmed cleanup after dismissal and after an injected timeout. Those were investigation checks. The added permanent throttling/query-count tests have been removed; UnoBrowserSampleRunTests.cs now matches main exactly. Existing startup, rendering, navigation, stroke, and clear checks remain.

The Blazor delayFirstPaint fault-injection case and extra JavaScript interception gate are also removed. The screenshot loop is exercised separately through helper contracts and a real browser mismatch-to-match test. It validates eventual output, not the correctness of every intermediate frame.

Nine Uno references contain reviewed navigation-spacing updates for the newer theme: 1556 CPU / 1582 Drawing navigation pixels, with zero changed pixels below row 49. No canvas/control reference pixels, Blazor references, tolerances, or skip policies changed. The sample guide is unchanged from main.

Related issues

Related to #5293 and #5359; follows merged #5353. #5359 remains Node-only and untouched.

Required skia PR

None.

Areas affected

  • Managed API (binding/)
  • Native / C API (externals/skia/src/c, include/c)
  • Generated P/Invoke bindings
  • Native dependency or Skia update (libpng, HarfBuzz, FreeType, zlib, milestone bump, …)
  • Views & integrations (MAUI, Uno, WPF, WinUI, Blazor, …)
  • Rendering output / visual behavior
  • Performance
  • Tests
  • Build, packaging, or CI
  • Documentation or samples

Changes

No public SkiaSharp API or library rendering changes. Browser captures finish CSS transitions; tests can opt into bounded eventual-image comparison. The stable Uno WASM sample records frames through startup and stops after natural splash dismissal. Reviewed reference edits affect Uno navigation only. Existing rendering tolerances, canvas/control reference pixels, and normal Uno sample tests are retained.

Testing

Local macOS ARM64, .NET 10, Playwright 1.55 Chromium, matching staged main-build packages (preview.0.26514.77).

  • dotnet test tests/SkiaSharp.Tests.Samples/SkiaSharp.Tests.Samples.csproj -p:TargetFramework=net10.0 -p:TargetFrameworks=net10.0 -- --filter-class 'SkiaSharp.Tests.Samples.UnoBrowserSampleRunTests' --results-directory /Users/matthew/.copilot/session-state/1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1/files/uno-simplified-results --report-trx — 2 passed after removing extra Uno instrumentation.
  • dotnet test tests/SkiaSharp.Tests.Samples/SkiaSharp.Tests.Samples.csproj -p:TargetFramework=net10.0 -p:TargetFrameworks=net10.0 -- --filter-method '*BlazorWebAssemblyCpuSampleRuns*' '*BrowserScreenshotsRetryUntilRendered*' '*ScreenshotComparisonBoundsCaptureTime*' --results-directory /Users/matthew/.copilot/session-state/1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1/files/cpu-ten-second-results --report-trx — 3 passed, including the CPU test with only a 10-second image-readiness loop.
  • dotnet test tests/SkiaSharp.Tests.Samples/SkiaSharp.Tests.Samples.csproj -p:TargetFramework=net10.0 -p:TargetFrameworks=net10.0 -- --filter-class 'SkiaSharp.Tests.Samples.SampleInfrastructureTests' --results-directory /Users/matthew/.copilot/session-state/1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1/files/screenshot-loop-final-infrastructure-results --report-trx — 86 passed: transient/persistent pixel and dimension comparisons, strict thresholds, diagnostics, missing/corrupt images, capture errors/cancellation, deadlines, existing infrastructure contracts.
  • dotnet test tests/SkiaSharp.Tests.Samples/SkiaSharp.Tests.Samples.csproj --no-build -p:TargetFramework=net10.0 -p:TargetFrameworks=net10.0 -- --filter-method '*BlazorWebAssemblyCpuSampleRuns*' '*BlazorWebAssemblyDrawingSampleDrawsAndClears*' '*BrowserScreenshots*' '*BrowserOperationsReportAllConsoleErrors*' '*BrowserCallbackReportsPageErrors*' --results-directory /Users/matthew/.copilot/session-state/1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1/files/screenshot-loop-browser-results --report-trx — 9 passed before the CPU deadline simplification; CPU was rerun as above.
  • dotnet test tests/SkiaSharp.Tests.Console.slnx -p:TargetFramework=net10.0 -p:TargetFrameworks=net10.0 — local failure only in the previously observed independent ganesh-gl/DiagonalLines macOS ARM64 reference mismatch (1832 outliers, 1310 allowed). No native code, skip policy, or that reference changed.
  • git diff --check — passed.

The stable workaround previously passed all 121 active checks in build 1637334, including Windows/Linux/macOS sample Host/Build and Docker. That is historical evidence, not validation of this latest screenshot-loop/simplification revision. Fresh CI is pending.

Screenshots (before / after): reviewed Uno navigation spacing
Before After
Original Uno navigation Current navigation reference

Only the navigation header changes; all CPU scene pixels remain identical.

Checklist

  • Tests added or updated (if omitted, explain why above)
  • Changes above lists all public API and behavioral changes (or "None.")
  • New/changed public API? Added or updated accurate source /// documentation and regenerated bindings when applicable
  • Native change? Companion mono/skia PR linked above and bindings regenerated

@github-actions

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

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 -- 5361

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 5361"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-5361/packages --name skiasharp-pr-5361
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-5361

@github-actions

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

Add the automation/staging label to build and publish a documentation preview for this PR.

Removing the label removes the preview. While the label is present, each new commit updates it.


This comment is automatically updated by the documentation staging workflow.

@mattleibow mattleibow added the copilot Created by GitHub Copilot label Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

📊 SkiaSharp benchmarks — PR #5361

⭐ this PR (full source build) vs 🌙 nightly · Linux · Windows · macOS

Informational only — this never blocks the PR. 🟢 faster / less allocation · 🔴 slower / more allocation; moves under 5% are hidden as noise.

⏱️ Times are raw BenchmarkDotNet means, and the ⭐ PR and baseline legs run on separate CI runners, so microbenchmarks can swing run-to-run — treat small time deltas as noise. Allocations are deterministic and the reliable signal. The interactive perf-dashboard (linked below) applies smoothing for the trend view.

Highlights

⏱️ Time — 🔴 13 slower · 🟢 49 faster

  • 🟢 MatrixMapPointsBenchmark.MapPoints(Points: 4096) · Windows · 2.80 µs → 1.28 µs (-54%)
  • 🟢 MatrixMapPointsBenchmark.MapPoints(Points: 256) · Windows · 203.5 ns → 102.3 ns (-50%)
  • 🟢 ColorMathBenchmark.ToColor(Colors: 4096) · Windows · 15.61 µs → 8.23 µs (-47%)
  • 🟢 BitmapDrawBenchmark.DrawScaledTiles(Tiles: 64) · Windows · 341.55 µs → 186.23 µs (-45%)
  • 🟢 ColorParseBenchmark.Parse(Iterations: 1000) · Windows · 86.05 µs → 47.33 µs (-45%)
  • …and 57 more (see details below)
Full per-OS benchmark deltas

Linux

⏱️ Time (vs 🌙 nightly 4.156.0-nightly.26514.3)

Benchmark baseline this PR Δ
RasterImageLifecycleBenchmark.CreateDataWithReleaseProc(Count: 256) 100.73 µs 110.69 µs 🔴 +10%
MatrixMapPointsBenchmark.MapPoints(Points: 256) 225.6 ns 203.7 ns 🟢 -10%
MatrixMapPointsBenchmark.MapPoints(Points: 4096) 2.73 µs 2.54 µs 🟢 -7%

Windows

⏱️ Time (vs 🌙 nightly 4.156.0-nightly.26514.3)

Benchmark baseline this PR Δ
MatrixMapPointsBenchmark.MapPoints(Points: 4096) 2.80 µs 1.28 µs 🟢 -54%
MatrixMapPointsBenchmark.MapPoints(Points: 256) 203.5 ns 102.3 ns 🟢 -50%
ColorMathBenchmark.ToColor(Colors: 4096) 15.61 µs 8.23 µs 🟢 -47%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 64) 341.55 µs 186.23 µs 🟢 -45%
ColorParseBenchmark.Parse(Iterations: 1000) 86.05 µs 47.33 µs 🟢 -45%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 64) 249.80 µs 141.05 µs 🟢 -44%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 256) 1.27 ms 727.51 µs 🟢 -43%
RuntimeEffectShaderBenchmark.DrawFrame 1.14 ms 658.61 µs 🟢 -42%
CanvasDrawBenchmark.Draw(Shapes: 64) 2.66 ms 1.54 ms 🟢 -42%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 256) 931.33 µs 539.97 µs 🟢 -42%
ColorMathBenchmark.PreMultiply(Colors: 4096) 13.03 µs 7.58 µs 🟢 -42%
CanvasDrawBenchmark.Draw(Shapes: 512) 21.23 ms 12.82 ms 🟢 -40%
SceneRenderBenchmark.RenderFrame(Complexity: 1) 2.21 ms 1.35 ms 🟢 -39%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 2048) 10.58 ms 6.53 ms 🟢 -38%
SceneRenderBenchmark.RenderFrame(Complexity: 4) 10.09 ms 6.24 ms 🟢 -38%
ColorMathBenchmark.UnPreMultiply(Colors: 4096) 11.63 µs 7.21 µs 🟢 -38%
ColorMathBenchmark.ToColorF(Colors: 4096) 13.63 µs 8.69 µs 🟢 -36%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 1024) 2.61 ms 1.68 ms 🟢 -35%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 2048) 3.06 ms 2.09 ms 🟢 -32%
MatrixMapPointsBenchmark.MapPoint(Points: 256) 4.77 µs 3.28 µs 🟢 -31%
MatrixMapPointsBenchmark.MapPoint(Points: 4096) 75.89 µs 52.85 µs 🟢 -30%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 1024) 750.82 µs 539.24 µs 🟢 -28%
PathBoundsBenchmark.TightBounds(Points: 1024) 15.68 µs 11.52 µs 🟢 -27%
PathBoundsBenchmark.TightBounds(Points: 64) 1.53 µs 1.12 µs 🟢 -27%
MatrixOpsBenchmark.Invert(Count: 4096) 133.26 µs 98.15 µs 🟢 -26%
…and 9 more

macOS

⏱️ Time (vs 🌙 nightly 4.156.0-nightly.26514.3)

Benchmark baseline this PR Δ
MatrixOpsBenchmark.Invert(Count: 4096) 81.34 µs 103.54 µs 🔴 +27%
MatrixMapPointsBenchmark.MapPoints(Points: 256) 133.6 ns 166.2 ns 🔴 +24%
SceneRenderBenchmark.RenderFrame(Complexity: 1) 1.67 ms 1.28 ms 🟢 -24%
RuntimeEffectShaderBenchmark.DrawFrame 756.19 µs 580.82 µs 🟢 -23%
RasterImageLifecycleBenchmark.CreateRasterImage(Count: 256) 199.35 µs 168.85 µs 🟢 -15%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 64) 235.38 µs 200.71 µs 🟢 -15%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 64) 246.25 µs 210.71 µs 🟢 -14%
MatrixMapPointsBenchmark.MapVector(Points: 4096) 49.99 µs 43.95 µs 🟢 -12%
MatrixMapPointsBenchmark.MapPoints(Points: 4096) 1.75 µs 1.96 µs 🔴 +12%
PathBoundsBenchmark.TightBounds(Points: 1024) 10.64 µs 9.45 µs 🟢 -11%
RasterImageLifecycleBenchmark.CreateDataWithReleaseProc(Count: 256) 93.81 µs 83.60 µs 🟢 -11%
MatrixMapPointsBenchmark.MapRect(Points: 256) 3.04 µs 3.34 µs 🔴 +10%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 2048) 5.80 ms 6.35 ms 🔴 +10%
MatrixMapPointsBenchmark.MapRect(Points: 4096) 59.56 µs 53.91 µs 🟢 -9%
MatrixMapPointsBenchmark.MapPoint(Points: 256) 1.14 µs 1.25 µs 🔴 +9%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 256) 696.53 µs 632.51 µs 🟢 -9%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 2048) 2.73 ms 2.94 ms 🔴 +8%
MatrixMapPointsBenchmark.MapVector(Points: 256) 2.64 µs 2.83 µs 🔴 +7%
MatrixOpsBenchmark.Concat(Count: 4096) 123.86 µs 132.69 µs 🔴 +7%
ColorParseBenchmark.Parse(Iterations: 1000) 67.91 µs 72.59 µs 🔴 +7%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 1024) 1.47 ms 1.57 ms 🔴 +7%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 256) 863.83 µs 805.25 µs 🟢 -7%
SceneRenderBenchmark.RenderFrame(Complexity: 4) 6.23 ms 5.81 ms 🟢 -7%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 1024) 686.42 µs 726.03 µs 🔴 +6%
ColorMathBenchmark.PreMultiply(Colors: 4096) 9.89 µs 9.35 µs 🟢 -5%

📈 Full interactive perf-dashboard & run details →

@mattleibow mattleibow changed the title Synchronize browser sample screenshots with CSS animations Finish browser CSS transitions before golden screenshots Oct 15, 2026
@mattleibow mattleibow changed the title Finish browser CSS transitions before golden screenshots Stabilize browser screenshots and Uno startup in sample CI Oct 15, 2026
@mattleibow
mattleibow marked this pull request as ready for review October 15, 2026 14:25
@mattleibow
mattleibow marked this pull request as draft October 15, 2026 16:57
@mattleibow mattleibow changed the title Stabilize browser screenshots and Uno startup in sample CI Stabilize browser screenshots and use stable Uno in sample CI Oct 15, 2026
@mattleibow mattleibow changed the title Stabilize browser screenshots and use stable Uno in sample CI Stabilize browser screenshots and stable Uno startup in sample CI Oct 15, 2026
@mattleibow
mattleibow marked this pull request as ready for review October 15, 2026 21:39
v and others added 8 commits October 16, 2026 00:37
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
Disable animations during golden captures so hover-exit transitions cannot race otherwise-ready canvas assertions. Add a frozen-midpoint transition regression that checks the captured pixels, without sleeps or relaxed comparisons.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
Upgrade the Basic Uno sample to SDK 6.8.0-dev.66, which ships the servicing backport of unoplatform/uno#24260. The pinned host could wait forever for a recorded frame while requesting only a present.

Map Uno and its unmirrored desktop dependencies to their publishing feed without allowing SkiaSharp or HarfBuzzSharp consumers to bypass staged artifacts. Cover both repository and generated feed mappings. Review and update only navigation pixels for the newer theme; preserve all canvas/control reference pixels and existing rendering tolerances.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
Keep repository NuGet defaults unchanged so benchmark projects can add their own nightly feed without inheriting a source mapping that excludes it. Verify the exact failed nightly benchmark restore, source SDK resolution, and isolated Uno startup with the sample-local configuration.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
Remove the sample-local NuGet.org config and isolated-consumer feed exception. Require the pinned Uno SDK and its dependencies to be mirrored instead, and cover the mirror-only source and mapping keys.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
Replace the 6.8 preview at the maintainer's request and remove the preview-specific splash-fix claim. Keep mirror-only package sources; validation identifies WebView2Aot 1.5.0 and DirectNAot/DirectNAot.Extensions 1.6.1 as the remaining unmirrored dependencies.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
Reproduced a persistent 60-second splash locally on Uno SDK 6.7.30 with 4x Chromium CPU throttling. Temporarily subscribe to CompositionTarget.Rendering before window activation so startup requests recorded frames, then unsubscribe when Uno removes its loader or the window closes. Bound the subscription with a timer that reports an explicit error on failure.

Exercise normal and throttled startup, retain strict golden checks, and verify loader observations stop after startup. Thirty-two workaround cold starts passed, including twenty consecutive 4x starts; a fault-injected persistent observation reported the timeout and detached. No loader removal, tolerance changes, or NuGet.org source exception.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
Cancel or fail the diagnostic if subsequent browser animation frames stop arriving, rather than leaving an async page evaluation unbounded.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
@mattleibow
mattleibow force-pushed the mattleibow-browser-screenshot-synchronization branch from 117cce1 to 2ed9fb9 Compare October 15, 2026 22:38
v and others added 6 commits October 16, 2026 00:47
Remove version-specific startup workaround details and describe package mirror requirements without naming a temporary dependency upgrade. Keep investigation history in the PR and implementation comments.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
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
Keep the merged CPU pixel-readiness condition, remove the extra delayFirstPaint gate, and opt the normal CPU capture into a bounded asynchronous image-comparison loop. Retry only dimension/pixel mismatches using unchanged tolerances; preserve one-shot validation and surface capture errors, cancellation, corrupt images, and missing references immediately. Do not add reference-capture success bypasses.

Cover transient and persistent comparisons, diagnostics, capture deadlines, invalid timeouts, errors and real browser recapture. Keep the sample guide evergreen.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
Remove the separate pixel probe and let the bounded screenshot comparison wait for the complete expected frame. Return on the first matching capture without changing pixel tolerances.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
Remove added CPU throttling and loader-query interception. Retain the normal startup, rendering, navigation, drawing and clear assertions alongside the browser startup workaround.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1d3be5b1-5a0b-452c-8a04-703fc4dd1ae1
@VirgilMing VirgilMing mentioned this pull request Oct 16, 2026
4 of 14 tasks
@mattleibow
mattleibow merged commit d29d6e6 into main Oct 17, 2026
124 of 125 checks passed
@mattleibow
mattleibow deleted the mattleibow-browser-screenshot-synchronization branch October 17, 2026 00:39
@github-actions github-actions Bot added this to the 4.156.0-rc.1 milestone Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot Created by GitHub Copilot

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant