Skip to content

Reset Hot Reload _disabled flag when a new debug session starts#83747

Open
noiseonwires wants to merge 1 commit into
dotnet:mainfrom
noiseonwires:reset-disabled-hotreload-flag
Open

Reset Hot Reload _disabled flag when a new debug session starts#83747
noiseonwires wants to merge 1 commit into
dotnet:mainfrom
noiseonwires:reset-disabled-hotreload-flag

Conversation

@noiseonwires
Copy link
Copy Markdown

@noiseonwires noiseonwires commented May 18, 2026

ManagedHotReloadLanguageServiceImpl._disabled is set to true whenever an unexpected exception is caught StartSessionAsync, BreakStateOrCapabilitiesChangedAsync, EndSessionAsync. Once set, the flag is never cleared - EndSessionAsync does not reset it and StartSessionAsync early-returns when it is true. This means a single failure permanently disables Hot Reload for the lifetime of the Roslyn process, even across debug session restarts. Users have to restart Visual Studio / the Roslyn LSP server to recover.

As discussed with @tmat some time ago, this change clears _disabled at the start of StartSessionAsync so that a fresh debug session is always given a chance to initialize. Any exception that flipped the flag is still a product bug worth fixing on its own, but this avoids a confusing and unrecoverable user-facing state where Hot Reload silently does nothing for the rest of the IDE session.

Investigated as part of a report where Hot Reload worked exactly once per Roslyn process and then stopped responding until the process was restarted.

Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings May 18, 2026 06:30
@noiseonwires noiseonwires requested a review from a team as a code owner May 18, 2026 06:30
@dotnet-policy-service dotnet-policy-service Bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label May 18, 2026
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Resets the Managed Hot Reload service’s _disabled flag on each new debug session so prior session failures don’t permanently disable Hot Reload.

Changes:

  • Removed the early-return when _disabled is set at session start.
  • Added logic to always reset _disabled to false at the beginning of StartSessionAsync, with explanatory comments.

@noiseonwires noiseonwires force-pushed the reset-disabled-hotreload-flag branch from 2532755 to 81bb815 Compare May 18, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants