Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ protected override async Task<bool> AcceptEvent(SessionId sessionId, string meth

case "Runtime.exceptionThrown":
{
if (!GetContext(sessionId).IsRuntimeReady)
// Don't process events from sessions we aren't tracking
if (!contexts.TryGetValue(sessionId, out ExecutionContext context))
return false;

if (!context.IsRuntimeReady)
{
string exceptionError = args?["exceptionDetails"]?["exception"]?["value"]?.Value<string>();
if (exceptionError == sPauseOnUncaught || exceptionError == sPauseOnCaught)
Expand All @@ -139,7 +143,11 @@ protected override async Task<bool> AcceptEvent(SessionId sessionId, string meth

case "Debugger.paused":
{
if (!GetContext(sessionId).IsRuntimeReady)
// Don't process events from sessions we aren't tracking
if (!contexts.TryGetValue(sessionId, out ExecutionContext context))
return false;

if (!context.IsRuntimeReady)
{
string reason = args?["reason"]?.Value<string>();
if (reason == "exception")
Expand All @@ -148,13 +156,13 @@ protected override async Task<bool> AcceptEvent(SessionId sessionId, string meth
if (exceptionError == sPauseOnUncaught)
{
await SendCommand(sessionId, "Debugger.resume", new JObject(), token);
GetContext(sessionId).PauseOnUncaught = true;
context.PauseOnUncaught = true;
return true;
}
if (exceptionError == sPauseOnCaught)
{
await SendCommand(sessionId, "Debugger.resume", new JObject(), token);
GetContext(sessionId).PauseOnCaught = true;
context.PauseOnCaught = true;
return true;
}
}
Expand Down