Skip to content

Implement auto-relaunch on process crash#53314

Open
tmat wants to merge 2 commits intodotnet:release/10.0.3xxfrom
tmat:CrashRestart
Open

Implement auto-relaunch on process crash#53314
tmat wants to merge 2 commits intodotnet:release/10.0.3xxfrom
tmat:CrashRestart

Conversation

@tmat
Copy link
Member

@tmat tmat commented Mar 7, 2026

When a process crashes (i.e. terminates with non-zero exit code) any change to the source files of the project or any of its dependencies will trigger relaunching of the project. If a project is launched multiple times and multiple processes crash each crashed one is relaunched after the file change.

@tmat tmat requested a review from a team as a code owner March 7, 2026 01:40
Copilot AI review requested due to automatic review settings March 7, 2026 01:40
@tmat
Copy link
Member Author

tmat commented Mar 7, 2026

@DustinCampbell ptal

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds auto-relaunch behavior to dotnet watch Hot Reload so that peripheral projects that crash (non-zero exit) are relaunched after a subsequent relevant file change, and includes a regression test for the scenario.

Changes:

  • Track crashed peripheral project instances and queue relaunch operations to be executed on subsequent file changes.
  • Integrate relaunch execution into the Hot Reload update/apply loop.
  • Add a new test validating relaunch-on-crash behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/dotnet-watch.Tests/HotReload/RuntimeProcessLauncherTests.cs Adds a new test that crashes a service process and asserts it is relaunched after a file change.
src/Dotnet.Watch/dotnet-watch/Properties/launchSettings.json Modifies the debug working directory setting for the dotnet-watch launch profile.
src/Dotnet.Watch/Watch/Utilities/ImmutableDictionaryExtensions.cs Adds helper extensions for ImmutableDictionary<TKey, ImmutableArray<TValue>> to simplify add/remove and iteration.
src/Dotnet.Watch/Watch/UI/IReporter.cs Introduces new message descriptors for relaunch lifecycle and crash notification.
src/Dotnet.Watch/Watch/Process/RunningProject.cs Adds a relaunch-flavored restart operation wrapper with dedicated logging.
src/Dotnet.Watch/Watch/HotReload/HotReloadDotNetWatcher.cs Wires relaunch behavior into the main watch loop and adjusts file-change waiting behavior for unhandled exceptions.
src/Dotnet.Watch/Watch/HotReload/CompilationHandler.cs Implements relaunch operation tracking, scheduling, and triggering based on changed files/project graph.

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