From 22522a0d78077cefbf86728534a564f2dc6edbd4 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 11 May 2020 10:40:12 -0700 Subject: [PATCH] Update to mono sources http://github.com/mono/mono/commit/57dcba253 (#21700) --- .../src/MonoDebugProxy/ws-proxy/MonoProxy.cs | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/Components/WebAssembly/DebugProxy/src/MonoDebugProxy/ws-proxy/MonoProxy.cs b/src/Components/WebAssembly/DebugProxy/src/MonoDebugProxy/ws-proxy/MonoProxy.cs index 6f73724fda..1b26dd93fd 100644 --- a/src/Components/WebAssembly/DebugProxy/src/MonoDebugProxy/ws-proxy/MonoProxy.cs +++ b/src/Components/WebAssembly/DebugProxy/src/MonoDebugProxy/ws-proxy/MonoProxy.cs @@ -186,16 +186,31 @@ namespace WebAssembly.Net.Debugging { var bpid = resp.Value["breakpointId"]?.ToString (); var locations = resp.Value["locations"]?.Values(); var request = BreakpointRequest.Parse (bpid, args); - context.BreakpointRequests[bpid] = request; + + // is the store done loading? + var loaded = context.Source.Task.IsCompleted; + if (!loaded) { + // Send and empty response immediately if not + // and register the breakpoint for resolution + context.BreakpointRequests [bpid] = request; + SendResponse (id, resp, token); + } + if (await IsRuntimeAlreadyReadyAlready (id, token)) { var store = await RuntimeReady (id, token); Log ("verbose", $"BP req {args}"); - await SetBreakpoint (id, store, request, token); + await SetBreakpoint (id, store, request, !loaded, token); } - var result = Result.OkFromObject (request.AsSetBreakpointByUrlResponse (locations)); - SendResponse (id, result, token); + if (loaded) { + // we were already loaded so we should send a response + // with the locations included and register the request + context.BreakpointRequests [bpid] = request; + var result = Result.OkFromObject (request.AsSetBreakpointByUrlResponse (locations)); + SendResponse (id, result, token); + + } return true; } @@ -709,7 +724,7 @@ namespace WebAssembly.Net.Debugging { foreach (var req in context.BreakpointRequests.Values) { if (req.TryResolve (source)) { - await SetBreakpoint (sessionId, context.store, req, token); + await SetBreakpoint (sessionId, context.store, req, true, token); } } } @@ -759,7 +774,7 @@ namespace WebAssembly.Net.Debugging { breakpointRequest.Locations.Clear (); } - async Task SetBreakpoint (SessionId sessionId, DebugStore store, BreakpointRequest req, CancellationToken token) + async Task SetBreakpoint (SessionId sessionId, DebugStore store, BreakpointRequest req, bool sendResolvedEvent, CancellationToken token) { var context = GetContext (sessionId); if (req.Locations.Any ()) { @@ -796,7 +811,8 @@ namespace WebAssembly.Net.Debugging { location = loc.AsLocation () }; - SendEvent (sessionId, "Debugger.breakpointResolved", JObject.FromObject (resolvedLocation), token); + if (sendResolvedEvent) + SendEvent (sessionId, "Debugger.breakpointResolved", JObject.FromObject (resolvedLocation), token); } req.Locations.AddRange (breakpoints);