Skip to content

[watch] Refactor CompilationHandler#55172

Open
tmat wants to merge 6 commits into
dotnet:release/10.0.4xxfrom
tmat:RunningProjects2
Open

[watch] Refactor CompilationHandler#55172
tmat wants to merge 6 commits into
dotnet:release/10.0.4xxfrom
tmat:RunningProjects2

Conversation

@tmat

@tmat tmat commented Jul 7, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 7, 2026 17:05
@tmat tmat requested a review from a team as a code owner July 7, 2026 17:05

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

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 CompilationHandler with RunningProjectsManager, ManagedCodeWorkspace, and ProjectUpdatesBuilder, 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.

Comment thread test/dotnet-watch.Tests/HotReload/CompilationHandlerTests.cs Outdated
Comment thread src/Dotnet.Watch/Watch/HotReload/ProjectUpdatesBuilder.cs Outdated
Comment thread src/Dotnet.Watch/Watch/HotReload/ProjectUpdatesBuilder.cs Outdated
Comment thread src/Dotnet.Watch/Watch/HotReload/RunningProjectsManager.cs Outdated
Comment thread src/Dotnet.Watch/Watch/HotReload/RunningProjectsManager.cs
Comment thread src/Dotnet.Watch/HotReloadClient/HotReloadClients.cs
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