[netcore] Implement/fix enum/nullable comparers.
[mono-project.git] / mono / tests / unhandled-exception-5.cs
blob65cff47d992292b5be579de808e5f74902d20926
1 using System;
2 using System.Diagnostics;
3 using System.Threading;
4 using System.Threading.Tasks;
6 class CustomException : Exception
10 class Driver
12 static ManualResetEvent mre = new ManualResetEvent (false);
14 class FinalizedClass
16 ~FinalizedClass ()
18 try {
19 throw new CustomException ();
20 } finally {
21 mre.Set ();
26 /* expected exit code: 255 */
27 static void Main (string[] args)
29 if (Environment.GetEnvironmentVariable ("TEST_UNHANDLED_EXCEPTION_HANDLER") != null)
30 AppDomain.CurrentDomain.UnhandledException += (s, e) => {};
32 new FinalizedClass();
34 GC.Collect ();
35 GC.WaitForPendingFinalizers ();
37 if (!mre.WaitOne (5000))
38 Environment.Exit (2);
40 /* Give a chance to the finalizer thread to finish executing the exception unwinding
41 * after the finally, before we exit with status 0 on the current thread */
42 Thread.Sleep (1000);
44 Environment.Exit (0);