[runtime] Synthesize IList and IReadOnlyList for the element type of enum errays...
[mono.git] / mono / tests / unhandled-exception-6.cs
1 using System;
2 using System.Diagnostics;
3 using System.Threading;
4 using System.Threading.Tasks;
5 using System.Runtime.Remoting.Messaging;
6
7 class CustomException : Exception
8 {
9 }
10
11 class Driver
12 {
13         /* expected exit code: 255 */
14         static void Main (string[] args)
15         {
16                 if (Environment.GetEnvironmentVariable ("TEST_UNHANDLED_EXCEPTION_HANDLER") != null)
17                         AppDomain.CurrentDomain.UnhandledException += (s, e) => {};
18
19                 var action = new Action (Delegate);
20                 var ares = action.BeginInvoke (Callback, null);
21
22                 Thread.Sleep (5000);
23
24                 Environment.Exit (1);
25         }
26
27         static void Delegate ()
28         {
29                 throw new CustomException ();
30         }
31
32         static void Callback (IAsyncResult iares)
33         {
34                 ((Action) ((AsyncResult) iares).AsyncDelegate).EndInvoke (iares);
35         }
36 }