Skip to content

[watch] Avoid updating running processes state in GetManagedCodeUpdatesAsync#55160

Open
tmat wants to merge 3 commits into
dotnet:release/10.0.4xxfrom
tmat:RunnningProjects1
Open

[watch] Avoid updating running processes state in GetManagedCodeUpdatesAsync#55160
tmat wants to merge 3 commits into
dotnet:release/10.0.4xxfrom
tmat:RunnningProjects1

Conversation

@tmat

@tmat tmat commented Jul 7, 2026

Copy link
Copy Markdown
Member

Refactor GetManagedCodeUpdatesAsync to only populate HotReloadProjectUpdatesBuilder but not terminate processes or discard updates.

Avoid capturing snapshot of running processes multiple times.
Move capturing of the snapshot from TerminatePeripheralProcessesAsyncto the callers.
Move previous update discarding from GetManagedCodeUpdatesAsync to ApplyManagedCodeAndStaticAssetUpdatesAndRelaunchAsync

Move capturing of the snapshot from TerminatePeripheralProcessesAsync to the callers.
Copilot AI review requested due to automatic review settings July 7, 2026 02:10
@tmat tmat requested a review from a team as a code owner July 7, 2026 02:10

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 refactors dotnet watch Hot Reload process-termination flow to avoid repeatedly capturing snapshots of running processes inside CompilationHandler.TerminatePeripheralProcessesAsync, shifting snapshot selection to the callers.

Changes:

  • Move peripheral-process termination out of CompilationHandler.GetManagedCodeUpdatesAsync and into HotReloadDotNetWatcher (and the Aspire control path).
  • Change TerminatePeripheralProcessesAsync to accept concrete RunningProject instances rather than project-path selectors.
  • Expose the current running-project map to callers via CompilationHandler.CurrentRunningProjects.

Reviewed changes

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

File Description
src/Dotnet.Watch/Watch/HotReload/HotReloadDotNetWatcher.cs Terminates peripheral processes based on the already-computed restart set before handling root-process restart/build steps.
src/Dotnet.Watch/Watch/HotReload/CompilationHandler.cs Refactors termination API to take RunningProject instances, adjusts update-building flow, and exposes current running projects.
src/Dotnet.Watch/Watch.Aspire/Server/WatchControlReader.cs Captures running-project snapshot from CompilationHandler and uses it to terminate/restart requested projects.

Comment thread src/Dotnet.Watch/Watch/HotReload/CompilationHandler.cs Outdated
Comment thread src/Dotnet.Watch/Watch/HotReload/CompilationHandler.cs Outdated
@tmat tmat changed the title Avoid capturing snapshot of running processes multiple times GetManagedCodeUpdatesAsync Jul 7, 2026
@tmat tmat changed the title GetManagedCodeUpdatesAsync Avoid updating state in GetManagedCodeUpdatesAsync Jul 7, 2026
@tmat tmat changed the title Avoid updating state in GetManagedCodeUpdatesAsync [watch] Avoid updating state in GetManagedCodeUpdatesAsync Jul 7, 2026
@tmat tmat changed the title [watch] Avoid updating state in GetManagedCodeUpdatesAsync [watch] Avoid updating running processes state in GetManagedCodeUpdatesAsync Jul 7, 2026
@tmat

tmat commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

@DustinCampbell ptal

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