Skip to content

test(imaging): Hold the superseded stream's decode in its test - #25993

Merged
ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/image-release-superseded-flake
Nov 5, 2026
Merged

ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/image-release-superseded-flake

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: part of #9080 (flaky tests roundup)

PR Type:

🏗️ Build or CI related changes

What changed? 🚀

Given_Image_Release.When_Stream_Load_Superseded_After_Decode_Then_Abandoned_Surface_Released failed intermittently on the Linux desktop lanes, both Skia and WebGPU (22 failures in the last 150 CI builds, none on Windows or macOS):

Assert.AreEqual failed. Expected:<1>. Actual:<2>. 'actual' expression: 'openedCount'. Only the stream the source still has may raise ImageOpened

The test sets a first stream, holds the UI thread until its off-thread decode completes, then sets a second stream that must supersede the first before its result is applied. On a CPU-starved agent, the first decode (a 100×100 image) can finish before BitmapImage.TryOpenSourceAsync reaches await Task.Run(...). The await then completes inline, so the first stream is published, and raises ImageOpened, inside the first SetSourceAsync call, before the second one exists. That ImageOpened is correct: the stream did open. The test simply never reached the state it covers.

The test's TrackingDecoder can now hold decodes running off the calling thread (HoldOtherThreadDecodes), and the test holds the first stream's decode until SetSourceAsync returns. Its result is then always applied by the dispatched continuation, which is the scenario under test. No product change.

Validation

Runtime, under Xvfb on WSL Ubuntu with the desktop SamplesApp, running the test 40 times in a row:

1 CPU (taskset -c 0) 2 CPUs 12 CPUs Windows
Before 32/40 failed ~5/40 failed 0/40 0/40
After 0/40 0/40 — —
  • The test still covers the product behavior: with the superseded check in BitmapImage.Publish disabled, it fails 40/40.
  • The whole Given_Image_Release class passes (59/59) on Windows and on Linux with 1 CPU and with all CPUs.

PR Checklist ✅

🤖 Generated with Claude Code

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@ramezgerges
ramezgerges enabled auto-merge November 3, 2026 19:27
@nventive-devops

Copy link
Copy Markdown
Contributor

The build 243377 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2492

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AnimatedBackVisualSourceSamplePage.png
    • AnimatedVisualsTestbedPage.png-dark
    • AppBarToggleButtonTest.png
    • ApplicationViewSizing.png-dark
    • ApplicationViewSizing.png
    • AppWindowFeatures.png-dark
    • AppWindowPositionAndSize.png
    • AppWindowTitleBar Properties.png-dark
    • Attributed_text_FontSize_Changing.png-dark
    • Attributed_text_FontSize_Changing.png
    • AuthenticationBroker_Demo.png-dark
    • AutoBorderStretchwithbottommargin.png
    • AutomationProperties_AutomationId.png-dark
    • AutomationPropertiesExtensions_Role.png-dark
    • AutomationProperties_Relations.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoSuggestBox_Description.png-dark
    • AutoSuggestBoxChosenSuggestion.png
    • AutoSuggestBox_Description.png
  • skia-windows-screenshots: 2458 changed over 2492

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png-dark
    • AppBarToggleButtonTest.png-dark
    • ApplicationViewSizing.png-dark
    • ApplicationViewSpanningRectsPage.png
    • AppWindowFeatures.png
    • AppWindowTitleBar Properties.png
    • Attributed_text_FontSize_Changing.png-dark
    • AuthenticationBroker_Demo.png-dark
    • AutoBorderStretchwithleftmargin.png-dark
    • AutoBorderStretchwithleftmargin.png
    • AutomationProperties_Relations.png
    • AutomationProperties_StructureAndProps.png-dark
    • AutoSuggestBox_Keyboard.png-dark
    • AutoSuggestBox_Keyboard.png
    • BasicEnability.png-dark
    • BasicEnability.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • BitmapIcon_Sizing.png-dark
    • BitmapIcon_Sizing.png

When_Stream_Load_Superseded_After_Decode_Then_Abandoned_Surface_Released
failed on CPU-starved Linux agents: the off-thread decode of the first
stream finished before SetSourceAsync awaited it, so the stream opened
inline and raised ImageOpened before the second one could supersede it.
The decode is now held until SetSourceAsync returns, so its result is
always applied by the dispatched continuation the test is about.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@ramezgerges

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 243771 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png
    • AnimatedVisualsTestbedPage.png-dark
    • ApplicationViewMode.png
    • AppWindowFeatures.png-dark
    • AppWindowPresenters.png
    • Attributed_text_FontSize_Changing.png
    • AutoBorderStretchwithleftmargin.png-dark
    • AutoBorderStretchwithrightmargin.png
    • AutomationProperties_Relations.png-dark
    • AutomationProperties_Relations.png
    • AutoSuggestBox_Icons.png-dark
    • AutoSuggestBox_Icons.png
    • Basics_Automated.png-dark
    • Basics_Automated.png
    • BindableDrawerLayout_ChangePane.png-dark
    • BindableDrawerLayout_ChangePane.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • BorderTopwithmargins.png-dark
    • BorderTopwithmargins.png
  • skia-windows-screenshots: 2458 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • AppBarButtonWithIconTest.png-dark
    • ApplicationViewMode.png
    • AppWindowClosing.png
    • AppWindowTitleBar Properties.png
    • Attributed_text_FontSize_Changing.png
    • AuthenticationBroker_Demo.png-dark
    • AutomationPropertiesExtensions_Role.png-dark
    • AutomationPropertiesExtensions_Role.png
    • BackGesture.png-dark
    • BackGesture.png
    • BasicEnability.png-dark
    • BasicEnability.png
    • BeginTime_MultipleAnimations.png-dark
    • BeginTime_MultipleAnimations.png
    • BindableDrawerLayout_ChangePane.png-dark
    • BindableDrawerLayout_ChangePane.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png

@ramezgerges
ramezgerges merged commit 8710cb6 into unoplatform:master Nov 5, 2026
48 checks passed
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.

4 participants