2 using System.Threading.Tasks;
7 public static async Task TestSingleAwait (bool throwException)
11 throw new ApplicationException ();
12 } catch (ApplicationException ex) {
13 Console.WriteLine ("x1a");
16 Console.WriteLine ("x2a");
22 Console.WriteLine ("end");
25 public static async Task TestDoubleAwait (bool throwException)
29 throw new ApplicationException ();
30 } catch (ApplicationException ex) {
31 Console.WriteLine ("x1a");
34 Console.WriteLine ("x2a");
37 Console.WriteLine ("x1b");
40 Console.WriteLine ("x2b");
44 Console.WriteLine ("end");
49 return Task.Factory.StartNew (() => false);
55 throw new ApplicationException ();
61 public static int Main ()
63 TestSingleAwait (true).Wait ();
64 Console.WriteLine (counter);
68 TestSingleAwait (false).Wait ();
74 TestDoubleAwait (true).Wait ();
75 Console.WriteLine (counter);
79 TestDoubleAwait (false).Wait ();