From 2b07c8c46523b816b1eac5c8af092e52b20a69d2 Mon Sep 17 00:00:00 2001 From: Thays Grazia Date: Tue, 11 Oct 2022 10:45:10 -0300 Subject: [PATCH] Fix debug a app that has another .NET Wasm instance in a service worker (#76072) --- src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs index b0d316e42dc..971d0b5d102 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs @@ -92,6 +92,9 @@ protected override async Task AcceptEvent(SessionId sessionId, JObject par { 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") { @@ -110,7 +113,6 @@ protected override async Task AcceptEvent(SessionId sessionId, JObject par { // 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(); -- GitLab