[runtime] Avoid holding the init lock while calling the cctor in mono_runtime_class_i...
[mono-project.git] / mcs / tests / test-async-79.cs
blobcd4dcb7320a893be1f1f7922e8739a0f2fd24991
1 using System;
2 using System.Threading.Tasks;
4 class Test
6 public int in_catch, in_finally;
8 async Task ExecuteCore ()
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 ();
23 public static int Main ()
25 var t = new Test ();
26 try {
27 t.ExecuteCore ().Wait ();
28 return 3;
29 } catch (AggregateException) {
32 if (t.in_catch != 1)
33 return 1;
35 if (t.in_finally != 1)
36 return 2;
38 return 0;