Skip to content

Conversation

@LittleLittleCloud
Copy link
Member

@LittleLittleCloud LittleLittleCloud commented Sep 29, 2025

This PR remove the stricter check for whether session active or not when hotreload agent's applyChange method get called.

Usually, the appplyChange method should only be invoked by debugger when there's active debugger session in the IDE, however, in reality, debugger might also call that applyChange method in some situations, like restarting app because of rude edits, which crashes VS if applyChange raise exceptions.

This PR performs a temporary fix to switch to a softer validation check when applyChange get called in the wrong time: leaving a tracing message in hotreload channel and silently return. In the future, a more thorough fix would be on the debugger side to avoid apply change when there's no active session.

https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2581474/

…checks and conditional logic to prevent errors when stopping and applying updates.
@LittleLittleCloud LittleLittleCloud requested a review from a team as a code owner September 29, 2025 17:27
Copy link
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

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

Approving only as a temporary fix until https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2581474 is addressed.
Needs to be reverted afterwards.

@LittleLittleCloud LittleLittleCloud merged commit 78b7013 into main Sep 29, 2025
5 checks passed
@LittleLittleCloud LittleLittleCloud deleted the u/xiaoyun/fix#2581577 branch September 29, 2025 20:50
@dotnet-policy-service dotnet-policy-service bot added this to the 18.1 milestone Sep 29, 2025
LittleLittleCloud added a commit that referenced this pull request Sep 30, 2025
…on (#9794)

* Improve session management in ProjectHotReloadSession by adding null checks and conditional logic to prevent errors when stopping and applying updates.

* Refactor ProjectHotReloadSession to remove RequireActiveSession method and update tests to handle session state without exceptions.

* add comment

* Remove unused using directive for System.Diagnostics.CodeAnalysis in ProjectHotReloadSession.cs

* Remove unused using directive for Microsoft.VisualStudio.RpcContracts.Commands in ProjectHotReloadSessionTests.cs
LittleLittleCloud added a commit that referenced this pull request Sep 30, 2025
…on (#9794) (#9797)

* Improve session management in ProjectHotReloadSession by adding null checks and conditional logic to prevent errors when stopping and applying updates.

* Refactor ProjectHotReloadSession to remove RequireActiveSession method and update tests to handle session state without exceptions.

* add comment

* Remove unused using directive for System.Diagnostics.CodeAnalysis in ProjectHotReloadSession.cs

* Remove unused using directive for Microsoft.VisualStudio.RpcContracts.Commands in ProjectHotReloadSessionTests.cs
@LittleLittleCloud LittleLittleCloud changed the title Remove back to prevent raising exception when there's no active session Revert back to prevent raising exception when there's no active session Sep 30, 2025
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.

4 participants