[corlib] Fix a few NSLogWriter issues. (#13799)
[mono-project.git] / mcs / tests / test-async-75.cs
blobead75c4dcb714c0c132c06ddcf442a5fd0055e78
1 using System;
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();
13 }).Unwrap();
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)
22 return 1;
24 return 0;