2 using System
.Threading
.Tasks
;
3 using System
.Runtime
.CompilerServices
;
4 using System
.Reflection
;
6 class CorrectEncodingOfNestedTypes
8 static async Task
<T
> GetAsync
<T
>(string s
) where T
: new()
10 return await Task
.Factory
.StartNew(async () => {
11 var response
= await Task
.FromResult (s
);
12 return (T
)new object();
16 public static int Main ()
18 var t
= typeof (CorrectEncodingOfNestedTypes
).GetNestedTypes (BindingFlags
.NonPublic
) [0].GetNestedTypes (BindingFlags
.NonPublic
) [0];
19 var m
= t
.GetMethods (BindingFlags
.NonPublic
| BindingFlags
.Instance
) [0];
20 var ca
= (AsyncStateMachineAttribute
) m
.GetCustomAttributes (true) [0];
21 if (ca
.StateMachineType
.GetGenericArguments ().Length
!= 1)