diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs index b47698ecf4d2..85fb14db2312 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs @@ -20,6 +20,7 @@ internal class MonoProxy : DevToolsProxy { private IList urlSymbolServerList; private HashSet sessions = new HashSet(); + private static readonly string[] s_executionContextIndependentCDPCommandNames = { "DotnetDebugger.setDebuggerProperty" }; protected Dictionary contexts = new Dictionary(); public static HttpClient HttpClient => new HttpClient(); @@ -258,7 +259,7 @@ protected override async Task AcceptCommand(MessageId id, JObject parms, C if (id == SessionId.Null) await AttachToTarget(id, token); - if (!contexts.TryGetValue(id, out ExecutionContext context)) + if (!contexts.TryGetValue(id, out ExecutionContext context) && !s_executionContextIndependentCDPCommandNames.Contains(method)) { if (method == "Debugger.setPauseOnExceptions") { @@ -267,7 +268,6 @@ protected override async Task AcceptCommand(MessageId id, JObject parms, C if (pauseOnException != PauseOnExceptionsKind.Unset) _defaultPauseOnExceptions = pauseOnException; } - // for Dotnetdebugger.* messages, treat them as handled, thus not passing them on to the browser return method.StartsWith("DotnetDebugger.", StringComparison.OrdinalIgnoreCase); }