diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs index 1da3b592b716d9..b5ad4a56204b4d 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs @@ -104,9 +104,9 @@ public async Task GetValueFromObject(JToken objRet, CancellationToken t return (memberObject, remaining); } - if (!string.IsNullOrEmpty(methodInfo.TypeInfo.Namespace)) + if (!string.IsNullOrEmpty(methodInfo?.TypeInfo?.Namespace)) { - typeId = await FindStaticTypeId(methodInfo.TypeInfo.Namespace + "." + classNameToFind); + typeId = await FindStaticTypeId(methodInfo?.TypeInfo?.Namespace + "." + classNameToFind); if (typeId != -1) continue; } @@ -204,6 +204,7 @@ public async Task Resolve(string varName, CancellationToken token) async Task ResolveAsLocalOrThisMember(string name) { + var nameTrimmed = name.Trim(); if (scopeCache.Locals.Count == 0 && !localsFetched) { Result scope_res = await proxy.GetScopeProperties(sessionId, scopeId, token); @@ -212,7 +213,7 @@ async Task ResolveAsLocalOrThisMember(string name) localsFetched = true; } - if (scopeCache.Locals.TryGetValue(name, out JObject obj)) + if (scopeCache.Locals.TryGetValue(nameTrimmed, out JObject obj)) return obj["value"]?.Value(); if (!scopeCache.Locals.TryGetValue("this", out JObject objThis)) @@ -222,7 +223,7 @@ async Task ResolveAsLocalOrThisMember(string name) return null; var rootResObj = await proxy.RuntimeGetPropertiesInternal(sessionId, objectId, null, token); - var objRet = rootResObj.FirstOrDefault(objPropAttr => objPropAttr["name"].Value() == name); + var objRet = rootResObj.FirstOrDefault(objPropAttr => objPropAttr["name"].Value() == nameTrimmed); if (objRet != null) return await GetValueFromObject(objRet, token); diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs index 8b1265d866d4d6..298c87646f05b1 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs @@ -500,8 +500,8 @@ protected override async Task AcceptCommand(MessageId id, string method, J { // Maybe this is an async method, in which case the debug info is attached // to the async method implementation, in class named: - // `{type_name}/::MoveNext` - methodInfo = assembly.TypesByName.Values.SingleOrDefault(t => t.FullName.StartsWith($"{typeName}/<{methodName}>"))? + // `{type_name}.::MoveNext` + methodInfo = assembly.TypesByName.Values.SingleOrDefault(t => t.FullName.StartsWith($"{typeName}.<{methodName}>"))? .Methods.FirstOrDefault(mi => mi.Name == "MoveNext"); } diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs index 0a414282b408d4..bcce8c58929a1e 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs @@ -253,7 +253,7 @@ await EvaluateOnCallFrameAndCheck(id, [Fact] public async Task EvaluateSimpleExpressions() => await CheckInspectLocalsAtBreakpointSite( - "DebuggerTests.EvaluateTestsClass/TestEvaluate", "run", 9, "run", + "DebuggerTests.EvaluateTestsClass.TestEvaluate", "run", 9, "run", "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateTestsClass:EvaluateLocals'); })", wait_for_event_fn: async (pause_location) => { @@ -432,7 +432,7 @@ await EvaluateOnCallFrameFail(id, [Fact] public async Task NegativeTestsInInstanceMethod() => await CheckInspectLocalsAtBreakpointSite( - "DebuggerTests.EvaluateTestsClass/TestEvaluate", "run", 9, "run", + "DebuggerTests.EvaluateTestsClass.TestEvaluate", "run", 9, "run", "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateTestsClass:EvaluateLocals'); })", wait_for_event_fn: async (pause_location) => { @@ -495,7 +495,7 @@ async Task EvaluateOnCallFrameFail(string call_frame_id, params (string expressi [Fact] public async Task EvaluateSimpleMethodCallsError() => await CheckInspectLocalsAtBreakpointSite( - "DebuggerTests.EvaluateMethodTestsClass/TestEvaluate", "run", 9, "run", + "DebuggerTests.EvaluateMethodTestsClass.TestEvaluate", "run", 9, "run", "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateMethodTestsClass:EvaluateMethods'); })", wait_for_event_fn: async (pause_location) => { @@ -519,7 +519,7 @@ public async Task EvaluateSimpleMethodCallsError() => await CheckInspectLocalsAt [Fact] public async Task EvaluateSimpleMethodCallsWithoutParms() => await CheckInspectLocalsAtBreakpointSite( - "DebuggerTests.EvaluateMethodTestsClass/TestEvaluate", "run", 9, "run", + "DebuggerTests.EvaluateMethodTestsClass.TestEvaluate", "run", 9, "run", "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateMethodTestsClass:EvaluateMethods'); })", wait_for_event_fn: async (pause_location) => { @@ -536,7 +536,7 @@ await EvaluateOnCallFrameAndCheck(id, [Fact] public async Task EvaluateSimpleMethodCallsWithConstParms() => await CheckInspectLocalsAtBreakpointSite( - "DebuggerTests.EvaluateMethodTestsClass/TestEvaluate", "run", 9, "run", + "DebuggerTests.EvaluateMethodTestsClass.TestEvaluate", "run", 9, "run", "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateMethodTestsClass:EvaluateMethods'); })", wait_for_event_fn: async (pause_location) => { @@ -560,7 +560,7 @@ await EvaluateOnCallFrameAndCheck(id, [Fact] public async Task EvaluateSimpleMethodCallsWithVariableParms() => await CheckInspectLocalsAtBreakpointSite( - "DebuggerTests.EvaluateMethodTestsClass/TestEvaluate", "run", 9, "run", + "DebuggerTests.EvaluateMethodTestsClass.TestEvaluate", "run", 9, "run", "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateMethodTestsClass:EvaluateMethods'); })", wait_for_event_fn: async (pause_location) => { @@ -670,7 +670,7 @@ await EvaluateOnCallFrameAndCheck(id, [Fact] public async Task EvaluateSimpleMethodCallsCheckChangedValue() => await CheckInspectLocalsAtBreakpointSite( - "DebuggerTests.EvaluateMethodTestsClass/TestEvaluate", "run", 9, "run", + "DebuggerTests.EvaluateMethodTestsClass.TestEvaluate", "run", 9, "run", "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateMethodTestsClass:EvaluateMethods'); })", wait_for_event_fn: async (pause_location) => { @@ -690,7 +690,7 @@ await EvaluateOnCallFrameAndCheck(id, [Fact] public async Task EvaluateStaticClass() => await CheckInspectLocalsAtBreakpointSite( - "DebuggerTests.EvaluateMethodTestsClass/TestEvaluate", "run", 9, "run", + "DebuggerTests.EvaluateMethodTestsClass.TestEvaluate", "run", 9, "run", "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateMethodTestsClass:EvaluateMethods'); })", wait_for_event_fn: async (pause_location) => { @@ -806,7 +806,7 @@ await EvaluateOnCallFrameAndCheck(id_second, [Fact] public async Task EvaluateStaticClassInvalidField() => await CheckInspectLocalsAtBreakpointSite( - "DebuggerTests.EvaluateMethodTestsClass/TestEvaluate", "run", 9, "run", + "DebuggerTests.EvaluateMethodTestsClass.TestEvaluate", "run", 9, "run", "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateMethodTestsClass:EvaluateMethods'); })", wait_for_event_fn: async (pause_location) => {