[bcl] Update BCL Linked Size
[mono-project.git] / mcs / tests / test-async-94.cs
blobce9a30409bb96c4fbef02fd8d06eeb9204534199
1 using System;
2 using System.Threading.Tasks;
3 using System.Runtime.CompilerServices;
5 [AsyncMethodBuilder (typeof(MyTaskMethodBuilder<>))]
6 class MyTask<T>
10 [AsyncMethodBuilder (typeof(MyTaskMethodBuilder))]
11 class MyTask
15 class MyTaskMethodBuilder
17 public static MyTaskMethodBuilder Create()
19 return null;
22 public MyTask Task {
23 get {
24 return null;
28 public void SetException (Exception exception)
33 public void SetResult ()
38 public void AwaitOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
43 public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
48 public void Start<TStateMachine> (ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
53 public void SetStateMachine (IAsyncStateMachine stateMachine)
59 class MyTaskMethodBuilder<T>
61 public static MyTaskMethodBuilder<T> Create()
63 return null;
66 public MyTask<T> Task {
67 get {
68 return null;
72 public void SetException (Exception exception)
77 public void SetResult (T result)
82 public void AwaitOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
87 public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
92 public void Start<TStateMachine> (ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
97 public void SetStateMachine (IAsyncStateMachine stateMachine)
103 class X
105 public async MyTask Test ()
107 await Task.Delay (1);
110 public async MyTask<int> Test2 ()
112 await Task.Delay (1);
113 return 2;
116 public async ValueTask<string> Test3 ()
118 await Task.Delay (1);
119 return "as";
122 public static void Main ()
124 var x = new X ();
125 var r1 = x.Test3 ().Result;