fix debugging

This commit is contained in:
Matt Parker
2025-11-08 19:32:46 +10:00
parent 2cd7323f13
commit 62fbc5fb20

View File

@@ -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<InitializedEvent>(@event =>
{
initializedEventTcs.SetResult();
});
debugProtocolHost.RegisterEventType<ExitedEvent>(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)
{