Skip to content

[tests] Prevent harness window animations from starving dispatch callbacks (#26600) - #26604

Merged
dalexsoto merged 1 commit into
release/10.0.1xxfrom
dev/alex/test10fix
Sep 14, 2026
Merged

dalexsoto merged 1 commit into
release/10.0.1xxfrom
dev/alex/test10fix

Conversation

@dalexsoto

Copy link
Copy Markdown
Member

Cause

The instrumented build
15294223
reproduced the recurring 60 Network setup timeouts and nine pasteboard callback timeouts on both macOS Tahoe architectures.

The diagnostics distinguish the failure from network connectivity:

  • Native connections reach Ready within milliseconds, but their managed callbacks never enter.
  • Default-global dispatch probes never execute; private-queue probes do.
  • Both native thread samples report Dispatch Thread Soft Limit: 64 reached in every sample.
  • All 64 affected workers are blocked in AppKit's -[NSAnimation _runBlocking].

Repeated test-harness window animations exhaust the shared dispatch workers, starving unrelated Network and pasteboard callbacks. Evidence is in the macos-arm64-monotouch-test.txt and
macos-x64-monotouch-test.txt files of
HtmlReport-mac_26_arm64mac_tahoe-1.

Fix

Set NSWindowAnimationBehavior.None on the windows owned by the macOS runner and TestRuntime.RunAsync, before showing them. Test windows and images are still displayed; windows created by individual tests retain their own animation behavior. Existing connection timeouts and test selections are unchanged.

Add a regression that opens/closes 128 async-test windows, exceeding the observed 64-worker limit, then requires the default global dispatch queue to remain responsive.

The temporary callback logging, queue probes, and native sampler have been removed after CI confirmation. The final diff does not modify Network bindings, connection waits, or the packaged runner.

Validation

  • ARM64 builds succeed with warnings-as-errors.
  • All eight dispatch tests, 171 Network tests, and ten pasteboard tests pass locally, including after removing the diagnostic instrumentation.
  • The 128-window regression also passes without the fix on this interactive Mac; the original failure remains specific to the CI host conditions.
  • Build 15295505 passes the entire Tahoe stage: all five suites pass, and the macOS apps report zero failures on both arm64 (3,686 tests run) and x64 (3,668 tests run).
  • Both CI architectures pass the 128-window regression and all nine previously failing pasteboard detection tests. Every reported global/private queue probe executes successfully.
  • Final instrumentation-free commit a75c5ef334 is verified by build 15296833: Tahoe again passes all five suites, with zero failures on arm64 (3,686 tests run) and x64 (3,668 tests run). Both pass the regression and the previously failing cases, with no diagnostic markers or probes present.
  • The final build's Sonoma, Sequoia, Tahoe, and Golden Gate macOS stages all pass.

The final diff is 24 inserted lines across four files. The investigation originated from builds
15287411, 15287821, 15287930, 15288406, and
15288436.


…backs (#26600)

## Cause

The instrumented [build
15294223](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15294223)
reproduced the recurring 60 Network setup timeouts and nine pasteboard
callback timeouts on both macOS Tahoe architectures.

The diagnostics distinguish the failure from network connectivity:

- Native connections reach Ready within milliseconds, but their managed
callbacks never enter.
- Default-global dispatch probes never execute; private-queue probes do.
- Both native thread samples report `Dispatch Thread Soft Limit: 64
reached` in every sample.
- All 64 affected workers are blocked in AppKit's `-[NSAnimation
_runBlocking]`.

Repeated test-harness window animations exhaust the shared dispatch
workers, starving unrelated Network and pasteboard callbacks. Evidence
is in the `macos-arm64-monotouch-test.txt` and
`macos-x64-monotouch-test.txt` files of
`HtmlReport-mac_26_arm64mac_tahoe-1`.

## Fix

Set `NSWindowAnimationBehavior.None` on the windows owned by the macOS
runner and `TestRuntime.RunAsync`, before showing them. Test windows and
images are still displayed; windows created by individual tests retain
their own animation behavior. Existing connection timeouts and test
selections are unchanged.

Add a regression that opens/closes 128 async-test windows, exceeding the
observed 64-worker limit, then requires the default global dispatch
queue to remain responsive.

The temporary callback logging, queue probes, and native sampler have
been removed after CI confirmation. The final diff does not modify
Network bindings, connection waits, or the packaged runner.

## Validation

- ARM64 builds succeed with warnings-as-errors.
- All eight dispatch tests, 171 Network tests, and ten pasteboard tests
pass locally, including after removing the diagnostic instrumentation.
- The 128-window regression also passes without the fix on this
interactive Mac; the original failure remains specific to the CI host
conditions.
- [Build
15295505](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15295505)
passes the entire Tahoe stage: all five suites pass, and the macOS apps
report **zero failures** on both arm64 (3,686 tests run) and x64 (3,668
tests run).
- Both CI architectures pass the 128-window regression and all nine
previously failing pasteboard detection tests. Every reported
global/private queue probe executes successfully.
- Final instrumentation-free commit `a75c5ef334` is verified by [build
15296833](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15296833):
Tahoe again passes all five suites, with zero failures on arm64 (3,686
tests run) and x64 (3,668 tests run). Both pass the regression and the
previously failing cases, with no diagnostic markers or probes present.
- The final build's Sonoma, Sequoia, Tahoe, and Golden Gate macOS stages
all pass.

The final diff is 24 inserted lines across four files. The investigation
originated from builds
[15287411](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15287411),
[15287821](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15287821),
[15287930](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15287930),
[15288406](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15288406),
and
[15288436](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15288436).

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 002f6f16-1fa4-434a-81af-f99c98564eb8
Copilot AI lite review requested due to automatic review settings September 14, 2026 16:39

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.

🟑 Changes recommended

The regression does not currently exercise the animation scenario, and startup-window coverage is missing.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Prevents macOS test-harness animations from starving dispatch callbacks and adds a regression test.

Changes:

  • Disables animations on runner and async-test windows.
  • Adds a dispatch responsiveness regression test.
  • Documents the harness behavior.
File summaries
File Review summary
tests/README.md Documents disabled harness animations.
tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs Regression test needs an initially incomplete task to exercise run-loop pumping; name the 64-worker boundary instead of using bare 128.
tests/common/Touch.Unit/Touch.Client/Runner/MacRunner.cs Add harness-level coverage for the startup-window animation path.
tests/common/TestRuntime.RunAsync.cs Disables animations on async-test windows.
Review details

Suppressed comments (2)

tests/common/Touch.Unit/Touch.Client/Runner/MacRunner.cs:29

  • πŸ’‘ Testing β€” The regression exercises only windows created by TestRuntime.RunAsync; it never observes this startup-window path, so a future change could restore the runner's default animation behavior while the test still passes. Please add harness-level coverage for this path or centralize both window creations behind a tested helper.

Rule: Bug fixes need regression tests

					window.AnimationBehavior = NSWindowAnimationBehavior.None;

tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs:175

  • πŸ’‘ maintainability β€” The stress boundary is encoded as a bare 128, while the test's rationale depends on the observed 64-worker cap. Name that cap and derive the window count so a future change to the stress threshold cannot silently make this regression stop exceeding it.
			for (var i = 0; i < 128; i++)
				Assert.That (TestRuntime.RunAsync (TimeSpan.FromSeconds (5), Task.CompletedTask), Is.True, $"Window {i}");
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment on lines +174 to +175
for (var i = 0; i < 128; i++)
Assert.That (TestRuntime.RunAsync (TimeSpan.FromSeconds (5), Task.CompletedTask), Is.True, $"Window {i}");
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

βœ… [PR Build #3f63a63] Build passed (Detect API changes) βœ…

Pipeline on Agent
Hash: 3f63a637387824c63a48a023faf994724481e3a6 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

βœ… [PR Build #3f63a63] Build passed (Build packages) βœ…

Pipeline on Agent
Hash: 3f63a637387824c63a48a023faf994724481e3a6 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

βœ… API diff for current PR / commit

NET (empty diffs)

βœ… API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 3f63a637387824c63a48a023faf994724481e3a6 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

βœ… [PR Build #3f63a63] Build passed (Build macOS tests) βœ…

Pipeline on Agent
Hash: 3f63a637387824c63a48a023faf994724481e3a6 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

πŸš€ [CI Build #3f63a63] Test results πŸš€

Test results

βœ… All tests passed on VSTS: test results.

πŸŽ‰ All 167 tests passed πŸŽ‰

Tests counts

βœ… cecil: All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
βœ… framework: All 2 tests passed. Html Report (VSDrops) Download
βœ… fsharp: All 4 tests passed. Html Report (VSDrops) Download
βœ… generator: All 5 tests passed. Html Report (VSDrops) Download
βœ… interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
βœ… introspection: All 6 tests passed. Html Report (VSDrops) Download
βœ… linker: All 44 tests passed. Html Report (VSDrops) Download
βœ… monotouch (iOS): All 14 tests passed. Html Report (VSDrops) Download
βœ… monotouch (MacCatalyst): All 16 tests passed. Html Report (VSDrops) Download
βœ… monotouch (macOS): All 16 tests passed. Html Report (VSDrops) Download
βœ… monotouch (tvOS): All 14 tests passed. Html Report (VSDrops) Download
βœ… msbuild: All 2 tests passed. Html Report (VSDrops) Download
βœ… sharpie: All 1 tests passed. Html Report (VSDrops) Download
βœ… windows: All 3 tests passed. Html Report (VSDrops) Download
βœ… xcframework: All 4 tests passed. Html Report (VSDrops) Download
βœ… xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

βœ… Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

βœ… Linux build succeeded

Pipeline on Agent
Hash: 3f63a637387824c63a48a023faf994724481e3a6 [PR build]

@dalexsoto
dalexsoto merged commit fd471cb into release/10.0.1xx Sep 14, 2026
49 checks passed
@dalexsoto
dalexsoto deleted the dev/alex/test10fix branch September 14, 2026 19:54
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