Merged
Conversation
Contributor
|
Thanks for your PR, @@tmat. |
d58f47e to
b5bf3f5
Compare
This was referenced Jun 12, 2025
f54fe57 to
9bb9b15
Compare
6d642dd to
787848e
Compare
Member
Author
|
@DustinCampbell ptal |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances Unix process termination and reliability for dotnet watch by multi-targeting the DeltaApplier, registering a SIGTERM handler, and improving WaitForExitAsync to avoid hangs. It also updates tests to be cross-platform and configures polling for file-watcher tests.
- Add SIGTERM registration in the startup hook for graceful shutdown on Unix (net10+).
- Refactor
ProcessRunner.WaitForExitAsyncwith a polling loop to address hangs on Linux. - Enable polling file watcher in tests and remove Windows‐only
[PlatformSpecificFact]attributes.
Reviewed Changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/.../WatchableApp.cs | Add comment and enable polling file watcher in tests |
| test/.../ProgramTests.cs (and many) | Replace [PlatformSpecificFact/Theory] with [Fact/Theory] for cross-platform tests |
| test/.../TestOptions.cs | Use 1s timeout on Unix and 0s on Windows for process cleanup |
| test/TestAssets/.../AppWithDeps/Program.cs | Increase loop delay from 10ms to 1000ms in test asset |
| src/.../dotnet-watch.csproj | Multi-target Microsoft.Extensions.DotNetDeltaApplier for net10.0 and netstandard2.1 |
| src/.../Internal/ProcessRunner.cs | Refactor WaitForExitAsync to poll HasExited and log verbose messages |
| src/.../HotReload/StartupHook.cs | Add RegisterPosixSignalHandlers to handle SIGTERM and exit process |
Comments suppressed due to low confidence (1)
src/BuiltInTools/DotNetDeltaApplier/StartupHook.cs:86
- No tests cover the new SIGTERM handler. Consider adding integration or unit tests to verify that the handler correctly triggers
Environment.Exit(0)on Unix when SIGTERM is received.
private static void RegisterPosixSignalHandlers()
test/TestAssets/TestProjects/WatchAppWithProjectDeps/AppWithDeps/Program.cs
Show resolved
Hide resolved
787848e to
7fb58e9
Compare
7fb58e9 to
e06e2ac
Compare
e06e2ac to
f0e9c2a
Compare
DustinCampbell
approved these changes
Jun 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multi-targets DotNetDeltaApplier in order to use Posix signal registration API. Register
SIGTERMsignal and exit the process. This is only needed for net10+ due to dotnet/docs#46226.Since our startup hook is the first to execute in the app process, the registered handler will be the last to execute. See dotnet/runtime#116557.
The change also had to update
WaitForExitAsyncto avoid hangs on Unix. It's unclear why. The implementation of this API is generally unreliable, see dotnet/runtime#109434.Blazor and WebApp tests still disabled. Needs more investigation.