Add support for Windows x64 Full AOT + LLVM + Interpreter on CI. (#15276)
[mono-project.git] / mcs / tests / test-async-83.cs
blobb12dd20fa74ced3532b5435d1f41aa69d961921e
1 using System;
2 using System.Threading.Tasks;
4 class MainClass
6 public static int Main ()
8 var t = GetSomeStrings (null);
9 try {
10 var s = t.Result;
11 return 1;
12 } catch (AggregateException e) {
13 if (e.InnerException is NullReferenceException)
14 return 0;
16 return 2;
20 public static async Task<string> GetSomeStrings (AsyncStringFactory myFactory)
22 var res = await myFactory?.GetSomeStringAsync ();
23 return res;
27 public class AsyncStringFactory
29 public async Task<string> GetSomeStringAsync ()
31 await Task.Yield();
32 return "foo";