diff options
Diffstat (limited to 'mcs/tests/test-async-56.cs')
-rw-r--r-- | mcs/tests/test-async-56.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mcs/tests/test-async-56.cs b/mcs/tests/test-async-56.cs new file mode 100644 index 0000000000..88f547e66d --- /dev/null +++ b/mcs/tests/test-async-56.cs @@ -0,0 +1,32 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +class Test +{ + public static int Main () + { + Task<int> t = TestMethod (); + + try { + t.Start (); + return 1; + } catch (InvalidOperationException) { + } + + try { + t.RunSynchronously (); + return 2; + } catch (InvalidOperationException) { + } + + Console.WriteLine ("ok"); + return 0; + } + + async static Task<int> TestMethod () + { + await Task.Delay (100000); + return 1; + } +}
\ No newline at end of file |