diff --git a/src/Components/Blazor/Server/src/MonoDebugProxy/ws-proxy/MonoProxy.cs b/src/Components/Blazor/Server/src/MonoDebugProxy/ws-proxy/MonoProxy.cs index d72c540f11..348b69c691 100644 --- a/src/Components/Blazor/Server/src/MonoDebugProxy/ws-proxy/MonoProxy.cs +++ b/src/Components/Blazor/Server/src/MonoDebugProxy/ws-proxy/MonoProxy.cs @@ -322,8 +322,7 @@ namespace WsProxy { name = method.Name, startLocation = method.StartLocation.ToJObject (), endLocation = method.EndLocation.ToJObject (), - }}, - @this = new { } + }} })); ++frame_id; @@ -485,11 +484,11 @@ namespace WsProxy { var values = res.Value? ["result"]? ["value"]?.Values ().ToArray (); var var_list = new List (); - + int i = 0; // Trying to inspect the stack frame for DotNetDispatcher::InvokeSynchronously // results in a "Memory access out of bounds", causing 'values' to be null, // so skip returning variable values in that case. - for (int i = 0; values != null && i < vars.Length; ++i) { + while (values != null && i < var_ids.Length && i < values.Length) { var value = values [i] ["value"]; if (((string)value ["description"]) == null) value ["description"] = value ["value"]?.ToString(); @@ -498,12 +497,24 @@ namespace WsProxy { name = vars [i].Name, value = values [i] ["value"] })); + i++; + } + //Async methods are special in the way that local variables can be lifted to generated class fields + //value of "this" comes here either + while (i < values.Length) { + String name = values [i] ["name"].ToString (); + if (name.IndexOf (">", StringComparison.Ordinal) > 0) + name = name.Substring (1, name.IndexOf (">", StringComparison.Ordinal) - 1); + var_list.Add (JObject.FromObject (new { + name = name, + value = values [i+1] ["value"] + })); + i = i + 2; } o = JObject.FromObject (new { result = var_list }); - SendResponse (msg_id, Result.Ok (o), token); }