diff options
author | Thays Grazia <thaystg@gmail.com> | 2020-01-02 17:26:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-02 17:26:14 +0300 |
commit | e20956305e0b9fabade97f31e1712ea920381d3f (patch) | |
tree | abeff781a44e15704c194df11f685b27dd8ea2ad /mcs/class/Mono.Debugger.Soft | |
parent | 54703867754ae6be00d5b63dfb36a9413abfa53e (diff) |
The behaviour expected of filter exceptions is: (#18309)
-> throw in a async task with a try catch in the caller -> don't stop
-> throw in a new thread with a try catch in the caller -> stop
-> throw in the main thread without any try catch -> stop
Including a new test to test the fix of #17601.
Fixing #16588, create a while 1 to stops the program execution when an exception is thrown and no try catch is found and MONO_DEBUG=suspend-on-unhandled.
Fixes #17601
Fixes #16588
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs | 29 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 13 |
2 files changed, 37 insertions, 5 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs index be5e6c7f3c9..945ea48c38b 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs @@ -558,6 +558,10 @@ public class Tests : TestsBase, ITest2 runtime_invoke_hybrid_exceptions(); return 0; } + if (args.Length > 0 && args [0] == "new_thread_hybrid_exception") { + new_thread_hybrid_exception(); + return 0; + } assembly_load (); breakpoints (); single_stepping (); @@ -2222,12 +2226,27 @@ public class Tests : TestsBase, ITest2 [MethodImplAttribute (MethodImplOptions.NoInlining)] public static void runtime_invoke_hybrid_exceptions () { Type rtType = Type.GetType("RuntimeInvokeWithThrowClass"); - ConstructorInfo rtConstructor = rtType.GetConstructor(Type.EmptyTypes); - object rtObject = rtConstructor.Invoke(new object[] { }); - MethodInfo rtMethod = rtType.GetMethod("RuntimeInvokeThrowMethod"); - rtMethod.Invoke(rtObject, new object[] { }); + ConstructorInfo rtConstructor = rtType.GetConstructor(Type.EmptyTypes); + object rtObject = rtConstructor.Invoke(new object[] { }); + MethodInfo rtMethod = rtType.GetMethod("RuntimeInvokeThrowMethod"); + rtMethod.Invoke(rtObject, new object[] { }); + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static void new_thread_hybrid_exception() { + try + { + Thread thread = new Thread(new_thread_hybrid_exception2); + thread.Start(); + } + catch (Exception sockEx) + { + } + } + public static void new_thread_hybrid_exception2() + { + throw new Exception("Error"); } - } public class SentinelClass : MarshalByRefObject { diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 52da50a45db..05d112e3f88 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -5151,6 +5151,19 @@ public class DebuggerTests vm.Exit (0); vm = null; } + + [Test] + public void TestNewThreadHybridSuspendException () { + TearDown (); + Start (dtest_app_path, "new_thread_hybrid_exception", forceExit: true); + var req2 = vm.CreateExceptionRequest (null, false, true, false); + req2.Enable (); + vm.Resume (); + var ev = GetNextEvent (); + Assert.IsInstanceOfType (typeof (ExceptionEvent), ev); + vm.Exit (0); + vm = null; + } [Test] public void TestAsyncDebugGenerics () { |