Skip to content

[net11.0] 'dotnet watch' works again now, so enable the corresponding tests. - #25712

Merged
rolfbjarne merged 4 commits into
net11.0from
dev/rolf/dotnet-watch-tests
Jun 22, 2026
Merged

rolfbjarne merged 4 commits into
net11.0from
dev/rolf/dotnet-watch-tests

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Also a few improvements, because this test turned out rather unpredictable locally:

  • Detect if the build failed, and terminate the test early. The build shouldn't fail, but yet it randomly does, and this makes the test fail immediately instead of having the test time out (after a 2 min wait).
  • Don't give stdin to 'dotnet watch', because 'dotnet test' goes bananas. Deadlocks everywhere (dozens of threads stuck while trying to determine the cursor position in the terminal, etc).
  • Disable build servers. Not sure if it helps, but when random things fail, random stuff gets tried, and this won't hurt.
  • Don't run desktop test apps with 'open', because then the test app's process is not a descendent of the 'dotnet watch' process, and if something goes wrong and the test needs to kill 'dotnet watch', the test app won't be killed.
  • Always cancel the 'dotnet watch' process at the end. Copilot suggested doing this, and it sounded good so here it is.
  • Augment the 'Execution' class to kill the entire process tree. Once again, Copilot suggested doing this, and it sounds like a good thing to do.
  • Add CoreCLR mobile variations.

… tests.

Also a few improvements, because this test turned out rather unpredictable locally:

* Detect if the build failed, and terminate the test early. The build shouldn't fail, but yet it randomly does, and this makes the test fail immediately instead of having the test time out (after a 2 min wait).
* Don't give stdin to 'dotnet watch', because 'dotnet test' goes bananas. Deadlocks everywhere (dozens of threads stuck while trying to determine the cursor position in the terminal, etc).
* Disable build servers. Not sure if it helps, but when random things fail, random stuff gets tried, and this won't hurt.
* Don't run desktop test apps with 'open', because then the test app's process is not a descendent of the 'dotnet watch' process, and if something goes wrong and the test needs to kill 'dotnet watch', the test app won't be killed.
* Always cancel the 'dotnet watch' process at the end. Copilot suggested doing this, and it sounded good so here it is.
* Augment the 'Execution' class to kill the entire process tree. Once again, Copilot suggested doing this, and it sounds like a good thing to do.
* Add CoreCLR mobile variations.
@rolfbjarne
rolfbjarne requested a review from Copilot June 17, 2026 13:14
@rolfbjarne

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

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 re-enables and expands the dotnet watch unit tests on the net11.0 branch, while improving test reliability and process handling in the shared Execution helper used by tests/tools.

Changes:

  • Extend Execution to optionally close stdin for spawned processes, and to kill process trees on cancellation/timeout (where supported).
  • Re-enable/expand DotNetWatchTest across additional Apple platforms and add CoreCLR/Mono runtime variations.
  • Improve DotNetWatchTest robustness (detect initial build failures earlier, avoid stdin deadlocks, and adjust cleanup behavior).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
tools/common/Execution.cs Adds stdin-closing option and introduces process-tree kill helper used on cancellation/timeout.
tests/dotnet/UnitTests/DotNetWatchTest.cs Re-enables/enlarges dotnet watch coverage and hardens the test flow & cleanup.

Comment thread tools/common/Execution.cs Resolved
Comment thread tools/common/Execution.cs Resolved
Comment thread tools/common/Execution.cs Resolved
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

- Remove unused pid/log parameters from KillProcess.
- Detect build failures early while waiting for app start, instead of
  timing out after 1 minute.
- Move 'Waiting for changes!' log after confirming the build succeeded.
- Log exceptions and timeout in cleanup path instead of swallowing them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne
rolfbjarne marked this pull request as ready for review June 22, 2026 13:58
@rolfbjarne
rolfbjarne enabled auto-merge (squash) June 22, 2026 13:58
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #05e2813] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 05e2813f08f1a003a43cd963fd23ec17231ccca2 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #05e2813] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 05e2813f08f1a003a43cd963fd23ec17231ccca2 [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: 05e2813f08f1a003a43cd963fd23ec17231ccca2 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #05e2813] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 05e2813f08f1a003a43cd963fd23ec17231ccca2 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #05e2813] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 205 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 9 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 26 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 30 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 23 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 26 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 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: 05e2813f08f1a003a43cd963fd23ec17231ccca2 [PR build]

@rolfbjarne
rolfbjarne merged commit ff1f5f2 into net11.0 Jun 22, 2026
53 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/dotnet-watch-tests branch June 22, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants