Commit 3adbc03
authored
Handle VM disconnection gracefully and reorder termination logic (#626)
* Ignore VMDisconnected on detach; reorder terminate
Wrap vm.dispose() in a try/catch to ignore VMDisconnectedException when the VM has already disconnected (e.g. process terminated) to avoid spurious errors during detach. Reorder calls in DisconnectRequestHandler to invoke terminate() before detach() when terminateDebuggee is true and the session is not attached, ensuring the debuggee is terminated prior to detaching.
* Always detach debug session on terminate
Wrap debugSession.terminate() in a try/finally so debugSession.detach() is always invoked when terminateDebuggee is true and the session is not attached. This ensures the session is detached even if terminate() throws, avoiding potential dangling sessions. Other detach logic is unchanged.1 parent ae2847e commit 3adbc03
2 files changed
Lines changed: 10 additions & 3 deletions
File tree
- com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core
- adapter/handler
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
0 commit comments