wrap StoppedEvent handler in try catch
This commit is contained in:
@@ -79,6 +79,8 @@ public class DebuggingService
|
|||||||
responder.SetResponse(new HandshakeResponse(signatureResponse));
|
responder.SetResponse(new HandshakeResponse(signatureResponse));
|
||||||
});
|
});
|
||||||
debugProtocolHost.RegisterEventType<StoppedEvent>(async void (@event) =>
|
debugProtocolHost.RegisterEventType<StoppedEvent>(async void (@event) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding); // The VS Code Debug Protocol throws if you try to send a request from the dispatcher thread
|
await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding); // The VS Code Debug Protocol throws if you try to send a request from the dispatcher thread
|
||||||
var additionalProperties = @event.AdditionalProperties;
|
var additionalProperties = @event.AdditionalProperties;
|
||||||
@@ -108,6 +110,12 @@ public class DebuggingService
|
|||||||
var continueRequest = new ContinueRequest { ThreadId = @event.ThreadId!.Value };
|
var continueRequest = new ContinueRequest { ThreadId = @event.ThreadId!.Value };
|
||||||
_debugProtocolHost.SendRequestSync(continueRequest);
|
_debugProtocolHost.SendRequestSync(continueRequest);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// TODO: use logger once this class is DI'd
|
||||||
|
Console.WriteLine($"Error handling StoppedEvent: {e}");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
debugProtocolHost.VerifySynchronousOperationAllowed();
|
debugProtocolHost.VerifySynchronousOperationAllowed();
|
||||||
var initializeRequest = new InitializeRequest
|
var initializeRequest = new InitializeRequest
|
||||||
|
|||||||
Reference in New Issue
Block a user