Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-async-91.cs
1 using System;
2 using System.Threading.Tasks;
3
4 class C : IDisposable
5 {
6         public void Dispose ()
7         {
8                 Console.WriteLine ("Disposed");
9                 TestClass.Passed++;
10         }
11 }
12
13 public class TestClass
14 {
15         public static int Passed;
16
17         public static async Task Test ()
18         {
19                 using (var device_resource = new C ()) {
20                         try {
21                                 Console.WriteLine ("aa");
22                                 return;
23                         } finally {
24                                 await Task.Delay (0);
25                         }
26                 }
27         }
28
29         public static int Main()
30         {
31                 Test ().Wait ();
32                 if (Passed != 1)
33                         return 1;
34
35                 Console.WriteLine ("PASSED");
36                 return 0;
37         }
38 }