Skip to content

fix: Fix hot code replacement event order - #648

Merged
wenyt (wenytang-ms) merged 1 commit into
microsoft:mainfrom
Mr-KnightCLI:fix/hcr-event-order
Nov 2, 2026
Merged

wenyt (wenytang-ms) merged 1 commit into
microsoft:mainfrom
Mr-KnightCLI:fix/hcr-event-order

Conversation

@Mr-KnightCLI

Copy link
Copy Markdown
Contributor

Fixes #559.

During hot code replacement, ProtocolServer can queue the stopped event while a request is being dispatched but send it immediately otherwise. Sending StoppedEvent before ContinuedEvent makes the delivered order depend on timing; in one path, the UI ends in a running state although the thread is suspended.

Send ContinuedEvent first and StoppedEvent last so the final UI state consistently reflects the suspended thread.

Validation: git diff --check passed. Tests were not run.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the hot code replacement event-ordering change.

No open issues 🎉

What changed in this PR

Fixes #559 by making hot code replacement event ordering consistent, so the debugger UI reflects the thread’s suspended state regardless of event delivery timing.

Changes:

  • Sends ContinuedEvent before StoppedEvent in the step callback.
  • Updates the comment to explain why stopped must be the final UI state.
File Description
com.microsoft.java.debug.plugin/​src/​main/​java/​com/​microsoft/​java/​debug/​plugin/​internal/​JavaHotCodeReplaceProvider.java Reorders hot code replacement events and documents the ordering requirement.

Review effort: Balanced

@wenytang-ms wenyt (wenytang-ms) changed the title Fix hot code replacement event order fix: Fix hot code replacement event order Nov 2, 2026
@wenytang-ms
wenyt (wenytang-ms) merged commit 7d62d35 into microsoft:main Nov 2, 2026
4 checks passed
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.

Race condition at the end of hot code replacement causes inconsistent UI state

3 participants