diff options
author | Alex Thibodeau <alexthibodeau@unity3d.com> | 2020-08-11 00:18:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 00:18:10 +0300 |
commit | 45f2b54612c4a30a6e0d7d90cfbc42994e676174 (patch) | |
tree | dfb9d08615e4dccd4ca9b510ce9f31d3438a410c /mcs | |
parent | 9d9ec219c14e21247f26d765058d5b69d802c8a0 (diff) |
Fixing debugger hang that would occur when inspecting a field that has a Debugger.Break in it's accessor. (#20211)
Fixing TypeInfo debugger test. I added a new property which broke the num properties check.
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs | 8 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 19 |
2 files changed, 26 insertions, 1 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs index f61919f0a38..db17abaeb8d 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs @@ -471,6 +471,14 @@ public class Tests : TestsBase, ITest2 #pragma warning restore 0414 + public string BreakInField + { + get { + Debugger.Break (); + return "Foo"; + } + } + public class NestedClass { } diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index e717d1f676e..e6ec1dd6296 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -1806,7 +1806,7 @@ public class DebuggerTests t = frame.Method.GetParameters ()[7].ParameterType; var props = t.GetProperties (); - Assert.AreEqual (3, props.Length); + Assert.AreEqual (4, props.Length); foreach (PropertyInfoMirror prop in props) { ParameterInfoMirror[] indexes = prop.GetIndexParameters (); @@ -4953,6 +4953,23 @@ public class DebuggerTests Assert.IsTrue ((e as StepEvent).Method.Name == "op_Equality" || (e as StepEvent).Method.Name == "if_property_stepping"); } + [Test] + public void DebuggerBreakInFieldDoesNotHang () { + vm.EnableEvents (EventType.UserBreak); + Event e = run_until ("o1"); + + StackFrame frame = e.Thread.GetFrames () [0]; + object val = frame.GetThis (); + Assert.IsTrue (val is ObjectMirror); + Assert.AreEqual ("Tests", (val as ObjectMirror).Type.Name); + ObjectMirror o = (val as ObjectMirror); + TypeMirror t = o.Type; + + MethodMirror m = t.GetProperty ("BreakInField").GetGetMethod(); + Value v = o.InvokeMethod (e.Thread, m, null, InvokeOptions.DisableBreakpoints); + AssertValue ("Foo", v); + } + #if !MONODROID_TOOLS void HandleEvents () { |