From 62fbc5fb2019cc283d8d368632e6d5c9d7c86e88 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Sat, 8 Nov 2025 19:32:46 +1000 Subject: [PATCH] fix debugging --- .../Features/Debugging/DebuggingService.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs b/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs index 9276a5d..f4adf8c 100644 --- a/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs +++ b/src/SharpIDE.Application/Features/Debugging/DebuggingService.cs @@ -41,6 +41,7 @@ public class DebuggingService process.Start(); var debugProtocolHost = new DebugProtocolHost(process.StandardInput.BaseStream, process.StandardOutput.BaseStream, false); + var initializedEventTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); _debugProtocolHost = debugProtocolHost; debugProtocolHost.LogMessage += (sender, args) => { @@ -62,6 +63,10 @@ public class DebuggingService { ; }); + debugProtocolHost.RegisterEventType(@event => + { + initializedEventTcs.SetResult(); + }); 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 @@ -117,6 +122,8 @@ public class DebuggingService } }; debugProtocolHost.SendRequestSync(attachRequest); + // AttachRequest -> HandshakeRequest -> InitializedEvent + await initializedEventTcs.Task; foreach (var breakpoint in breakpointsByFile) {