From 71dd132213e0a508066a14472ac09c8094fc9f45 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Wed, 27 Aug 2025 20:24:55 +1000 Subject: [PATCH] disconnect debugger on debugee terminate --- .../Features/Debugging/DebuggingService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs b/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs index 139f1f5..2ebd919 100644 --- a/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs +++ b/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs @@ -57,9 +57,13 @@ public class DebuggingService { ; }); + debugProtocolHost.RegisterEventType(async void (@event) => + { + await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding); // The VS Code Debug Protocol throws if you try to send a request from the dispatcher thread + debugProtocolHost.SendRequestSync(new DisconnectRequest()); + }); debugProtocolHost.RegisterClientRequestType(responder => { - var args = responder.Arguments; var signatureResponse = VsSigner.Sign(responder.Arguments.Value); responder.SetResponse(new HandshakeResponse(signatureResponse)); });