Skip to content

Commit 915dc27

Browse files
Fix debug a app that has another .NET Wasm instance in a service worker (#76073)
Co-authored-by: Thays Grazia <[email protected]>
1 parent 8419a11 commit 915dc27

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ protected override async Task<bool> AcceptEvent(SessionId sessionId, JObject par
9292
{
9393
case "Runtime.consoleAPICalled":
9494
{
95+
// Don't process events from sessions we aren't tracking
96+
if (!contexts.TryGetValue(sessionId, out ExecutionContext context))
97+
return false;
9598
string type = args["type"]?.ToString();
9699
if (type == "debug")
97100
{
@@ -110,7 +113,6 @@ protected override async Task<bool> AcceptEvent(SessionId sessionId, JObject par
110113
{
111114
// The optional 3rd argument is the stringified assembly
112115
// list so that we don't have to make more round trips
113-
ExecutionContext context = GetContext(sessionId);
114116
string loaded = a[2]?["value"]?.ToString();
115117
if (loaded != null)
116118
context.LoadedFiles = JToken.Parse(loaded).ToObject<string[]>();

0 commit comments

Comments
 (0)