2 using System.Threading.Tasks;
6 static Exception ex = new ApplicationException ();
8 public static int Main ()
10 if (Test (5, null).Result != 5)
16 } catch (AggregateException ae) {
17 if (ae.InnerException != ex)
22 Test (15, ex).Wait ();
24 } catch (AggregateException ae) {
25 if (ae.InnerException != ex)
30 TestGeneric (5).Wait ();
32 } catch (AggregateException ae) {
33 if (ae.InnerException != ex)
38 TestGeneric (15).Wait ();
40 } catch (AggregateException ae) {
41 if (ae.InnerException != ex)
48 async static Task<int> Test (int x, Exception e)
51 Console.WriteLine (x);
54 } catch (Exception) when (x != 15) {
55 await Task.FromResult (0);
62 async static Task<int> TestGeneric (int x)
65 Console.WriteLine (x);
67 } catch when (x != 15) {
68 await Task.FromResult (0);