Skip to content

test: Guard When_MsAppData against an indefinite hang - #24033

Merged
MartinZikmund merged 2 commits into
feature/breakingchangesfrom
dev/mazi/msappdata-hang
Aug 11, 2026
Merged

MartinZikmund merged 2 commits into
feature/breakingchangesfrom
dev/mazi/msappdata-hang

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: closes #23967

PR Type:

🏗️ Build or CI related changes

What changed? 🚀

Given_BitmapSource.When_MsAppData awaited its ImageOpened TaskCompletionSource with a bare await tcs.Task — no timeout, no cancellation token. On Skia legs where the image never opens, the test does not fail; it blocks forever.

The cost of that is much larger than one test:

  • the job runs until the 60-minute cap and is killed,
  • no results XML is written, so PublishTestResults fails and every result from the ~650 tests that already ran is lost,
  • the remaining tests in the shard never execute,
  • a CI agent is occupied for an hour producing nothing.

This bounds the wait to 30 seconds, so the underlying bug surfaces as a single deterministic test failure with the rest of the suite intact.

before: "Running test When_MsAppData()" -> 50 min of silence -> agent killed at 60 min -> no results xml
after:  test fails in 30 s with a real message -> results xml written -> suite continues

Observed on build 226708 (Uno.UI - CI), where the stage was killed on attempts 1 and 3, both ending on exactly the same line. In that same build the Tests - Desktop Skia Linux Framebuffer stage passed, because the existing [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.SkiaFrameBuffer)] skips the test there — the X11 leg has no such exclusion and is still exposed.

Scope

This is a containment fix, not a root-cause fix. It does not make ms-appdata image loading work on the affected leg — #23967 stays open for that. The SkiaFrameBuffer exclusion is left untouched. Expect the X11 Linux leg to now report When_MsAppData as a failing test rather than hanging.

PR Checklist ✅

Copilot AI lite review requested due to automatic review settings August 10, 2026 18:47
@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 10s —— View job


Review complete

  • Read changed file and diff
  • Analyze for correctness, style, and coverage
  • Post inline comments for any findings
  • Post summary

Summary

The fix is correct and tightly scoped. Replacing await tcs.Task with await tcs.Task.WaitAsync(TimeSpan.FromSeconds(30)) is the right mechanism: on timeout it throws TimeoutException, which the test runner records as a failure, the results XML is still written, and the rest of the suite continues. The comment explaining the CI impact earns its place (non-obvious "why" per the code-style rules). [GitHubWorkItem] traceability and the Conventional Commits title (test:) are correct.

1 suggestion (non-blocking): On the broken Skia legs, ImageFailed fires before the timeout. Without an ImageFailed → TrySetException handler the test wastes 30 s of CI time per run and reports a generic TimeoutException instead of the real error message. When_MsAppData_StreamDisposed_FileNotLocked (same file, line 196) already shows this pattern — see the inline comment for a suggested change.

Severity Count
Suggestion 1
Blocking 0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Given_BitmapSource.When_MsAppData runtime test to prevent CI shards from hanging indefinitely when ImageOpened never fires on some Skia legs, by adding a 30-second bound to the awaited TaskCompletionSource.

Changes:

  • Bound the ImageOpened wait using WaitAsync(TimeSpan.FromSeconds(30)) to prevent an infinite hang.
  • Added inline comments documenting the CI hang impact and rationale for the timeout.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 32s —— View job


Review complete

  • Read changed file and diff
  • Analyze for correctness, style, and coverage
  • Post inline comments for any findings
  • Post summary

Summary

The update is correct and complete. Both prior suggestions are applied:

  • ImageFailed → TrySetException handler is wired (matching the error-message format from When_MsAppData_StreamDisposed_FileNotLocked at line 199 — consistent with the test class pattern).
  • [Timeout(60000)] guards the storage-copy operations (GetFileFromApplicationUriAsync / CopyAsync) that precede the WaitAsync, closing the gap copilot identified.

The two-layer defence is well-structured: WaitAsync(30s) fails fast if the image event fires or never fires; [Timeout(60000)] catches the unlikely hang inside the file I/O path above it. The comment on [Timeout] earns its place (non-obvious why a second guard is needed when WaitAsync is already there).

No inline findings — nothing blocking merge.

Severity Count
Blocking 0
Suggestion 0

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 226824 found UI Test snapshots differences: skia-linux-screenshots: 74, skia-windows-screenshots: 110

Details
  • skia-linux-screenshots: 74 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DynamicFont.png-dark
    • DoubleImageBrushInList.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ImageIconPage.png-dark
    • Buttons.png-dark
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • CalendarView_Theming.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • DamageRegion_ShadowChildPaintingCaster.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Examples.png
  • skia-windows-screenshots: 110 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ColorPickerSample.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • Examples.png
    • ImageSourceUrlMsAppDataScheme.png-dark
    • Attributed_text_FontSize_Changing.png-dark
    • Buttons.png-dark
    • Buttons.png
    • Image_UseTargetSize.png-dark
    • Image_UseTargetSizeLate.png
    • Image_With_RotateTransform.png-dark
    • Image_With_RotateTransform.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Attributed_text_FontSize_Changing.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ContentPresenter_Template.png-dark

MartinZikmund and others added 2 commits August 11, 2026 09:52
Given_BitmapSource.When_MsAppData awaited its ImageOpened
TaskCompletionSource with no timeout. On Skia legs where the image never
opens the test blocks until the 60-minute job cap, so no results XML is
written and PublishTestResults fails for the whole suite.

Bound the wait to 30 seconds so the underlying issue (#23967) surfaces as
one deterministic test failure instead of a lost agent hour.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01J33LeqZULiZ9Pr7BmFdRnL
Addresses PR review feedback:

- Hook ImageFailed into the same TaskCompletionSource so a reported load
  failure surfaces the platform error immediately instead of waiting out
  the 30-second timeout, matching When_MsAppData_StreamDisposed_FileNotLocked.
- Add [Timeout] so a stall in GetFileFromApplicationUriAsync or CopyAsync
  is bounded too; WaitAsync only covers the final await.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01J33LeqZULiZ9Pr7BmFdRnL
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/msappdata-hang branch from 44142e1 to 1a7376c Compare August 11, 2026 07:57
@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 23s —— View job


Review complete

  • Read changed file and diff
  • Analyze for correctness, style, and coverage
  • Post inline comments for any findings
  • Post summary

Summary

The final state of the diff is correct and complete. The two-layer defence is well-structured:

  • [Timeout(60000)] on the method bounds the whole async body including the GetFileFromApplicationUriAsync/CopyAsync storage calls that WaitAsync cannot reach.
  • sut.ImageFailed → tcs.TrySetException fails fast with a useful message (matching the Image failed to load: {e.ErrorMessage} format used elsewhere in the class) rather than burning the full 30 s on broken Skia legs.
  • tcs.Task.WaitAsync(TimeSpan.FromSeconds(30)) closes the remaining gap where neither event fires — the "neither event fires" comment now accurately describes that residual case.

No inline findings. The class-level [RunsOnUIThread] ensures handlers attached between image.Source = sut and the first await are race-free. Conventional Commits title (test:) and [GitHubWorkItem] traceability are correct.

Severity Count
Blocking 0
Suggestion 0

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 226924 found UI Test snapshots differences: skia-linux-screenshots: 74, skia-windows-screenshots: 108

Details
  • skia-linux-screenshots: 74 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • DynamicFont.png-dark
    • Buttons.png-dark
    • Buttons.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • DamageRegion_ShadowChildPaintingCaster.png-dark
    • Examples.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DoubleImageBrushInList.png-dark
    • CalendarView_Theming.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ImageIconPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
  • skia-windows-screenshots: 108 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • EmailManagerTests.png-dark
    • EmailManagerTests.png
    • AnimatedVisualsTestbedPage.png-dark
    • Contacts_Pick.png-dark
    • Contacts_Pick.png
    • ExpanderColorValidationPage.png-dark
    • Examples.png
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • ButtonClippingTestsControl.png-dark
    • ContextRequested.png

@MartinZikmund
MartinZikmund merged commit 127adea into feature/breakingchanges Aug 11, 2026
47 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/msappdata-hang branch August 11, 2026 17:51
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.

5 participants