Merge pull request #4380 from alexanderkyte/conflicting_attrs
[mono.git] / mcs / tests / test-async-79.cs
1 using System;
2 using System.Threading.Tasks;
3
4 class Test
5 {
6         public int in_catch, in_finally;
7
8         async Task ExecuteCore ()
9         {
10                 try {
11                         await Task.Run (() => { 
12                                 throw new ApplicationException ();
13                         });
14                 } catch (Exception ex) {
15                         ++in_catch;
16                         throw;
17                 } finally {
18                         ++in_finally;
19                         await Task.Yield ();
20                 }
21         }
22
23         public static int Main ()
24         {
25                 var t = new Test ();
26                 try {
27                         t.ExecuteCore ().Wait ();
28                         return 3;
29                 } catch (AggregateException) {                  
30                 }
31
32                 if (t.in_catch != 1)
33                         return 1;
34
35                 if (t.in_finally != 1)
36                         return 2;
37
38                 return 0;
39         }
40 }