diff options
author | Thays Grazia <thaystg@gmail.com> | 2019-10-07 15:22:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-07 15:22:06 +0300 |
commit | 18fac0a24190cb3f90057d86232e773758bb1284 (patch) | |
tree | 9587cad07d9831f1089ba7babb2a17157057bfad /mcs/class/Mono.Debugger.Soft | |
parent | 35c6b7691f4043fd49d8393b84224f0d1df1e7fe (diff) |
[debugger][exception] Debugger breaks on handled exceptions (#17106)
* If there is a perform_wait_callback in the stack there will be another catch generated by the owner thread, so we don't need to throw, we can continue and find the next catch.
Fixes #17083
* Reverting unit test changed on commit 405d521.
* Fixing assert when calling mono_jit_info_get_method if it was a trampoline.
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs | 22 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 19 |
2 files changed, 39 insertions, 2 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs index 37dd0e3e6ad..b790b02d2f2 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs @@ -507,6 +507,10 @@ public class Tests : TestsBase, ITest2 unhandled_exception_wrapper (); return 0; } + if (args.Length >0 && args [0] == "unhandled-exception-perform-wait-callback") { + unhandled_exception_perform_wait_callback (); + return 0; + } if (args.Length >0 && args [0] == "unhandled-exception-endinvoke") { unhandled_exception_endinvoke (); return 0; @@ -1650,6 +1654,24 @@ public class Tests : TestsBase, ITest2 } [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static void unhandled_exception_perform_wait_callback () { + try + { + var results = ResolveAsync().GetAwaiter().GetResult(); + } + catch (SocketException sockEx) + { + //Console.WriteLine("correctly handled"); + } + } + + public static async Task<List<string>> ResolveAsync() + { + var addresses = await System.Net.Dns.GetHostAddressesAsync("foo.bar.baz"); + return new List<string>(addresses.Select(addr => addr.ToString())); + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] public static void unhandled_exception_endinvoke () { Action action = new Action (() => { diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 7e066570d5a..a624b9b8a84 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -4233,8 +4233,6 @@ public class DebuggerTests var e = run_until ("unhandled_exception_endinvoke"); vm.Resume (); - var e1 = GetNextEvent (); //this should be the exception - vm.Resume (); var e2 = GetNextEvent (); Assert.IsFalse (e2 is ExceptionEvent); @@ -4282,6 +4280,23 @@ public class DebuggerTests } [Test] + public void UnhandledException4 () { + vm.Exit (0); + + Start (dtest_app_path, "unhandled-exception-perform-wait-callback"); + + var req = vm.CreateExceptionRequest (null, false, true); + req.Enable (); + + var e = run_until ("unhandled_exception_perform_wait_callback"); + vm.Resume (); + + var e2 = GetNextEvent (); + Assert.IsTrue (e2 is VMDeathEvent); + vm = null; + } + + [Test] public void GCWhileSuspended () { // Check that objects are kept alive during suspensions Event e = run_until ("gc_suspend_1"); |