Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / unhandled-exception-8.cs
1
2 using System;
3 using System.Threading;
4
5 class CustomException : Exception
6 {
7 }
8
9 class Driver
10 {
11         /* expected exit code: 255 */
12         public static void Main ()
13         {
14                 if (Environment.GetEnvironmentVariable ("TEST_UNHANDLED_EXCEPTION_HANDLER") != null)
15                         AppDomain.CurrentDomain.UnhandledException += (s, e) => {};
16
17                 ManualResetEvent mre = new ManualResetEvent(false);
18
19                 ThreadPool.RegisterWaitForSingleObject (mre, (state, timedOut) => { throw new CustomException (); }, null, -1, true);
20                 mre.Set();
21
22                 Thread.Sleep (5000);
23         }
24 }