Merge pull request #5210 from alexrp/profiler-runtime-settings
[mono.git] / mono / tests / unhandled-exception-5.cs
index 33136b33590b44acb8f884f480caa70f997efde2..65cff47d992292b5be579de808e5f74902d20926 100644 (file)
@@ -26,6 +26,9 @@ class Driver
        /* expected exit code: 255 */
        static void Main (string[] args)
        {
+               if (Environment.GetEnvironmentVariable ("TEST_UNHANDLED_EXCEPTION_HANDLER") != null)
+                       AppDomain.CurrentDomain.UnhandledException += (s, e) => {};
+
                new FinalizedClass();
 
                GC.Collect ();
@@ -34,6 +37,10 @@ class Driver
                if (!mre.WaitOne (5000))
                        Environment.Exit (2);
 
+               /* Give a chance to the finalizer thread to finish executing the exception unwinding
+                * after the finally, before we exit with status 0 on the current thread */
+               Thread.Sleep (1000);
+
                Environment.Exit (0);
        }
 }