1 // Compiler options: -langversion:future
4 using System.Threading;
5 using System.Threading.Tasks;
9 static ManualResetEvent caught = new ManualResetEvent (false);
11 static async void Test (ManualResetEvent mre)
13 var a = Task.Factory.StartNew (() => {
14 if (mre.WaitOne (1000))
15 throw new ApplicationException ();
18 await a.ConfigureAwait (false);
21 public static int Main ()
23 ManualResetEvent mre = new ManualResetEvent (false);
26 var handler = new UnhandledExceptionEventHandler (CurrentDomain_UnhandledException);
27 AppDomain.CurrentDomain.UnhandledException += handler;
31 if (!caught.WaitOne (1000))
36 AppDomain.CurrentDomain.UnhandledException -= handler;
40 static void CurrentDomain_UnhandledException (object sender, UnhandledExceptionEventArgs e)
42 if (e.ExceptionObject is ApplicationException)