diff options
author | Larry Ewing <lewing@microsoft.com> | 2019-11-25 20:55:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-25 20:55:21 +0300 |
commit | b42845c56750747af754e57983fe51a6c85bac4e (patch) | |
tree | 60641f89cf7629791baadfdc30602a8ff622d728 /sdks | |
parent | 10795da1c065c5349bf78ca4d39cfc7992fe5f7c (diff) |
Fix issue in debugger variable inspection (#17900)
Diffstat (limited to 'sdks')
-rw-r--r-- | sdks/wasm/Mono.WebAssembly.DebuggerProxy/MonoProxy.cs | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/sdks/wasm/Mono.WebAssembly.DebuggerProxy/MonoProxy.cs b/sdks/wasm/Mono.WebAssembly.DebuggerProxy/MonoProxy.cs index 4ef0ff4e0c2..32af59fadbb 100644 --- a/sdks/wasm/Mono.WebAssembly.DebuggerProxy/MonoProxy.cs +++ b/sdks/wasm/Mono.WebAssembly.DebuggerProxy/MonoProxy.cs @@ -426,8 +426,8 @@ namespace WsProxy { return; } - var values = res.Value?["result"]?["value"]?.Values<JObject>().ToArray(); - + try { + var values = res.Value?["result"]?["value"]?.Values<JObject>().ToArray() ?? Array.Empty<JObject>(); var var_list = new List<JObject>(); // Trying to inspect the stack frame for DotNetDispatcher::InvokeSynchronously @@ -437,22 +437,27 @@ namespace WsProxy { { string fieldName = (string)values[i]["name"]; if (fieldName.Contains("k__BackingField")){ - fieldName = fieldName.Replace("k__BackingField", ""); - fieldName = fieldName.Replace("<", ""); - fieldName = fieldName.Replace(">", ""); - } - var_list.Add(JObject.FromObject(new - { - name = fieldName, - value = values[i+1]["value"] - })); + fieldName = fieldName.Replace("k__BackingField", ""); + fieldName = fieldName.Replace("<", ""); + fieldName = fieldName.Replace(">", ""); + } + var value = values [i + 1] ["value"]; + if (((string)value ["description"]) == null) + value ["description"] = value ["value"]?.ToString (); + + var_list.Add(JObject.FromObject(new { + name = fieldName, + value + })); } o = JObject.FromObject(new { result = var_list }); - + } catch (Exception e) { + Debug ($"failed to parse {res.Value}"); + } SendResponse(msg_id, Result.Ok(o), token); } @@ -495,7 +500,7 @@ namespace WsProxy { var_list.Add (JObject.FromObject (new { name = vars [i].Name, - value = values [i] ["value"] + value })); i++; } @@ -506,9 +511,14 @@ namespace WsProxy { if (name.IndexOf (">", StringComparison.Ordinal) > 0) name = name.Substring (1, name.IndexOf (">", StringComparison.Ordinal) - 1); + + var value = values [i+1] ["value"]; + if (((string)value ["description"]) == null) + value ["description"] = value ["value"]?.ToString (); + var_list.Add (JObject.FromObject (new { - name = name, - value = values [i+1] ["value"] + name, + value })); i = i + 2; } |