Skip to content

Stabilize XamlMessageBox UI-thread dispatch test#2430

Merged
brianrob merged 1 commit into
microsoft:mainfrom
brianrob:brianrob/intermittent-ui-test
May 28, 2026
Merged

Stabilize XamlMessageBox UI-thread dispatch test#2430
brianrob merged 1 commit into
microsoft:mainfrom
brianrob:brianrob/intermittent-ui-test

Conversation

@brianrob

Copy link
Copy Markdown
Member

Summary

  • Convert Show_AutoDispatchesToUIThreadFromBackgroundThread to use xUnit's [WpfFact] dispatcher instead of manually creating and shutting down a WPF dispatcher thread.
  • Await the background XamlMessageBox.Show call directly and keep a timeout assertion for clearer failure behavior.
  • Preserve the existing regression coverage for background-thread auto-dispatch and UI-thread no-op dispatch.

Validation

  • Reproduced the intermittent local hang before the change.
  • 50/50 filtered runs passed after the change.
  • 20/20 full PerfViewTests.dll runs passed after the change, with 87/87 tests passing each run.

Use xUnit's WPF dispatcher for the XamlMessageBox background-thread dispatch regression test instead of creating and shutting down a private dispatcher thread. This avoids intermittent hangs from dispatcher/Application state while preserving the regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@brianrob brianrob requested a review from a team as a code owner May 27, 2026 18:08
Dispatcher.CurrentDispatcher.InvokeShutdown();
};
Application app = Application.Current ?? new Application();
app.ShutdownMode = ShutdownMode.OnExplicitShutdown;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you have multiple WPF based tests, it might be worth using an IFixture to set these things up. But if it's the only test, not worth bothering with.

@mconnew mconnew left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:shipit:

@brianrob brianrob merged commit 3162599 into microsoft:main May 28, 2026
5 checks passed
@brianrob brianrob deleted the brianrob/intermittent-ui-test branch May 28, 2026 22:02
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.

2 participants