[ilasm] Don't break arguments compatiblity
[mono-project.git] / mcs / tests / test-async-59.cs
blob64be3d00bf12e9fb3a3718e8f6a2710ca1a71ecf
1 using System;
2 using System.Threading;
3 using System.Threading.Tasks;
5 class X
7 static bool unobserved;
9 public static int Main ()
11 TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
12 try {
13 Test ().Wait ();
15 GC.Collect ();
16 GC.WaitForPendingFinalizers ();
17 if (unobserved)
18 return 1;
20 return 0;
21 } finally {
22 TaskScheduler.UnobservedTaskException -= TaskScheduler_UnobservedTaskException;
26 static void TaskScheduler_UnobservedTaskException (object sender, UnobservedTaskExceptionEventArgs e)
28 unobserved = true;
29 Console.WriteLine ("unobserved");
32 static async Task Test ()
34 try {
35 await ThrowAsync ();
36 } catch {
40 static async Task ThrowAsync()
42 await Task.Delay (5);
44 throw new Exception ("boom");