[tuner] handle the case with multiple "preserve" attributes
[mono-project.git] / mcs / tests / test-async-26.cs
bloba1b859299c0bb5dcb1129ded001354d79ab7e900
1 using System;
2 using System.Threading;
3 using System.Threading.Tasks;
5 namespace ConsoleApplication1
7 class Program
9 public static Task<TResult> Run<TResult> (Func<Task<TResult>> function)
11 var t = Task<Task<TResult>>.Factory.StartNew (function);
12 return GetTaskResult (t);
15 async static Task<TResult> GetTaskResult<TResult> (Task<Task<TResult>> task)
17 return await task.Result;
20 public static int Main ()
22 var t2 = Run (() => Task<int>.Factory.StartNew (() => 5));
24 if (!t2.Wait (1000)) {
25 Console.WriteLine (t2.Status);
26 return 1;
29 Console.WriteLine ("ok");
30 return 0;