[watch] Refactor CompilationHandler#55172
Open
tmat wants to merge 6 commits into
Open
Conversation
Move capturing of the snapshot from TerminatePeripheralProcessesAsync to the callers.
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors dotnet-watch Hot Reload orchestration by splitting responsibilities previously centralized in CompilationHandler into focused components for (1) tracking/relaunching running projects, (2) maintaining the Roslyn workspace/session, and (3) building per-change update sets. This simplifies the watch loop integration points and updates Aspire control-pipe restart handling accordingly.
Changes:
- Replaces
CompilationHandlerwithRunningProjectsManager,ManagedCodeWorkspace, andProjectUpdatesBuilder, and rewires the Hot Reload loop to use them. - Updates process launching and Aspire control-pipe restart flow to operate via
RunningProjectsManager. - Adjusts tests/utilities for the refactor (nullability tweak and output-wait helper usage).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet-watch.Tests/TestUtilities/TestAssetsManagerExtensions.cs | Adjusts identifiers parameter nullability to allow nullable elements. |
| test/dotnet-watch.Tests/HotReload/MobileHotReloadTests.cs | Switches to WaitUntilOutputContains assertions. |
| test/dotnet-watch.Tests/HotReload/CompilationHandlerTests.cs | Updates test to use RunningProjectsManager + ManagedCodeWorkspace instead of CompilationHandler. |
| src/Dotnet.Watch/Watch/Process/RunningProject.cs | Adds XML doc clarifying RunningProject/client relationship. |
| src/Dotnet.Watch/Watch/Process/ProjectLauncher.cs | Replaces dependency on CompilationHandler with RunningProjectsManager. |
| src/Dotnet.Watch/Watch/HotReload/RunningProjectsManager.cs | New: owns tracking of running projects, update history, relaunch operations, and applies updates. |
| src/Dotnet.Watch/Watch/HotReload/ProjectUpdatesBuilder.cs | New: computes managed/static asset updates and restart/rebuild/redeploy sets. |
| src/Dotnet.Watch/Watch/HotReload/ManagedCodeWorkspace.cs | New: encapsulates Roslyn workspace graph/file updates and Hot Reload session management. |
| src/Dotnet.Watch/Watch/HotReload/ManagedCodeSnapshot.cs | New: immutable snapshot carrier for solution + project instances map. |
| src/Dotnet.Watch/Watch/HotReload/HotReloadProjectUpdatesBuilder.cs | Removes old update-bucket type superseded by ProjectUpdatesBuilder. |
| src/Dotnet.Watch/Watch/HotReload/HotReloadDotNetWatcher.cs | Rewires main watch loop to new components; adds compilation warm-up call. |
| src/Dotnet.Watch/Watch/HotReload/CompilationHandler.cs | Removes monolithic handler replaced by the new split components. |
| src/Dotnet.Watch/Watch.Aspire/Server/WatchControlReader.cs | Updates control pipe restart logic to use ProjectLauncher/RunningProjectsManager. |
| src/Dotnet.Watch/Watch.Aspire/Server/ProcessLauncherFactory.cs | Updates construction of WatchControlReader. |
| src/Dotnet.Watch/HotReloadClient/HotReloadClients.cs | Updates XML docs to reflect browser involvement and client semantics. |
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.
No description provided.