diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/Firefox/FirefoxMonoProxy.cs b/src/mono/wasm/debugger/BrowserDebugProxy/Firefox/FirefoxMonoProxy.cs index ba8cdf740ef92e7f6e1ff84ab678cc0b68019fc3..50a2502b6626ca0821b9bfddfeb03d188409b70d 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/Firefox/FirefoxMonoProxy.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/Firefox/FirefoxMonoProxy.cs @@ -960,7 +960,7 @@ internal async Task OnGetBreakableLines(MessageId msg_id, string script_id if (!SourceId.TryParse(script_id, out SourceId id)) return false; - SourceFile src_file = (await LoadStore(msg_id, token)).GetFileById(id); + SourceFile src_file = (await LoadStore(msg_id, false, token)).GetFileById(id); await SendEvent(msg_id, "", JObject.FromObject(new { lines = src_file.BreakableLines.ToArray(), from = script_id }), token); return true; @@ -971,7 +971,7 @@ internal override async Task OnGetScriptSource(MessageId msg_id, string sc if (!SourceId.TryParse(script_id, out SourceId id)) return false; - SourceFile src_file = (await LoadStore(msg_id, token)).GetFileById(id); + SourceFile src_file = (await LoadStore(msg_id, false, token)).GetFileById(id); try { diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs index 89089fc2f1e77d47a6523c6ed9b62519d978eeed..aa67403542f80d2216f2d46ef6d5a157f6867eec 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs @@ -80,7 +80,7 @@ public async Task GetValueFromObject(JToken objRet, CancellationToken t public async Task<(JObject containerObject, ArraySegment remaining)> ResolveStaticMembersInStaticTypes(ArraySegment parts, CancellationToken token) { string classNameToFind = ""; - var store = await proxy.LoadStore(sessionId, token); + var store = await proxy.LoadStore(sessionId, false, token); var methodInfo = context.CallStack.FirstOrDefault(s => s.Id == scopeId)?.Method?.Info; if (methodInfo == null) diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs index 1d2b77c3b8bf3ae61fcff68f092e6ddd5d3509e8..9a0d105bf1e5ea4f4a32534338777b96bb90c2de 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs @@ -844,7 +844,7 @@ private async Task ProcessEnC(SessionId sessionId, ExecutionContext contex byte[] pdb_buf = retDebuggerCmdReader.ReadBytes(pdb_size); var assemblyName = await context.SdbAgent.GetAssemblyNameFromModule(moduleId, token); - DebugStore store = await LoadStore(sessionId, token); + DebugStore store = await LoadStore(sessionId, true, token); AssemblyInfo asm = store.GetAssemblyByName(assemblyName); var methods = DebugStore.EnC(asm, meta_buf, pdb_buf); foreach (var method in methods) @@ -953,7 +953,7 @@ protected virtual async Task SendCallStack(SessionId sessionId, ExecutionC var methodId = retDebuggerCmdReader.ReadInt32(); var il_pos = retDebuggerCmdReader.ReadInt32(); var flags = retDebuggerCmdReader.ReadByte(); - DebugStore store = await LoadStore(sessionId, token); + DebugStore store = await LoadStore(sessionId, true, token); var method = await context.SdbAgent.GetMethodInfo(methodId, token); if (await ShouldSkipMethod(sessionId, context, event_kind, j, method, token)) @@ -1252,7 +1252,7 @@ private async Task OnAssemblyLoadedJSEvent(SessionId sessionId, JObject ev { try { - var store = await LoadStore(sessionId, token); + var store = await LoadStore(sessionId, true, token); var assembly_name = eventArgs?["assembly_name"]?.Value(); if (store.GetAssemblyByName(assembly_name) != null) @@ -1311,7 +1311,7 @@ private async Task OnSetEntrypointBreakpoint(SessionId sessionId, JObject args, var assemblyName = assemblyAndMethodTokenArr[0]; var methodToken = Convert.ToInt32(assemblyAndMethodTokenArr[1]) & 0xffffff; //token - var store = await LoadStore(sessionId, token); + var store = await LoadStore(sessionId, true, token); AssemblyInfo assembly = store.GetAssemblyByName(assemblyName); if (assembly == null) { @@ -1469,7 +1469,7 @@ internal virtual async Task OnSourceFileAdded(SessionId sessionId, SourceFile so } } - internal async Task LoadStore(SessionId sessionId, CancellationToken token) + internal async Task LoadStore(SessionId sessionId, bool tryUseDebuggerProtocol, CancellationToken token) { ExecutionContext context = GetContext(sessionId); @@ -1486,9 +1486,12 @@ internal async Task LoadStore(SessionId sessionId, CancellationToken else { var useDebuggerProtocol = false; - (int MajorVersion, int MinorVersion) = await context.SdbAgent.GetVMVersion(token); - if (MajorVersion == 2 && MinorVersion >= 61) - useDebuggerProtocol = true; + if (tryUseDebuggerProtocol) + { + (int MajorVersion, int MinorVersion) = await context.SdbAgent.GetVMVersion(token); + if (MajorVersion == 2 && MinorVersion >= 61) + useDebuggerProtocol = true; + } await foreach (SourceFile source in context.store.Load(sessionId, loaded_files, context, useDebuggerProtocol, token)) { @@ -1541,7 +1544,7 @@ protected async Task RuntimeReady(SessionId sessionId, CancellationT await context.SdbAgent.EnableReceiveRequests(EventKind.EnC, token); await context.SdbAgent.EnableReceiveRequests(EventKind.MethodUpdate, token); - DebugStore store = await LoadStore(sessionId, token); + DebugStore store = await LoadStore(sessionId, true, token); context.ready.SetResult(store); await SendEvent(sessionId, "Mono.runtimeReady", new JObject(), token); await SendMonoCommand(sessionId, MonoCommands.SetDebuggerAttached(RuntimeId), token); @@ -1724,7 +1727,7 @@ internal virtual async Task OnGetScriptSource(MessageId msg_id, string scr if (!SourceId.TryParse(script_id, out SourceId id)) return false; - SourceFile src_file = (await LoadStore(msg_id, token)).GetFileById(id); + SourceFile src_file = (await LoadStore(msg_id, true, token)).GetFileById(id); try {