diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs index af4707ae7b8cfe..0695061b96ff25 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs @@ -55,6 +55,9 @@ protected override async Task AcceptEvent(SessionId sessionId, string meth { case "Runtime.consoleAPICalled": { + // Don't process events from sessions we aren't tracking + if (!contexts.TryGetValue(sessionId, out ExecutionContext context)) + return false; string type = args["type"]?.ToString(); if (type == "debug") { @@ -68,7 +71,6 @@ protected override async Task AcceptEvent(SessionId sessionId, string meth { // The optional 3rd argument is the stringified assembly // list so that we don't have to make more round trips - ExecutionContext context = GetContext(sessionId); string loaded = a?[2]?["value"]?.ToString(); if (loaded != null) context.LoadedFiles = JToken.Parse(loaded).ToObject();