[build] Fix warning (#4177)
[mono-project.git] / mcs / tests / test-async-66.cs
blobbbba0980228e9ebddbe0c8c6a2d42dcc5a58b416
1 using System;
2 using System.Threading.Tasks;
4 class TestFinally
6 static int counter;
8 async static Task Test (bool throwException)
10 try {
11 if (throwException)
12 throw new ApplicationException ();
14 ++counter;
15 System.Console.WriteLine ();
16 } finally {
17 counter += 10;
18 await Task.Delay (2);
19 counter += 100;
21 counter += 1000;
24 static int Main ()
26 Test (false).Wait ();
27 if (counter != 1111)
28 return 1;
30 counter = 0;
31 try {
32 Test (true).Wait ();
33 return 2;
34 } catch (AggregateException) {
37 if (counter != 110)
38 return 3;
40 return 0;