[interp] Fall back to old implementation when calling on proxy
[mono-project.git] / mcs / tests / test-async-76.cs
blobb7e5da9ef3e3e18192e0239bf3b50dc869c8c81b
1 // Compiler options: -r:$REF_DIR/Mono.Cecil.dll
3 using System;
4 using System.Threading.Tasks;
5 using Mono.Cecil;
6 using System.Reflection;
7 using System.Runtime.CompilerServices;
9 namespace N
11 class C
15 interface I<T>
17 void Foo (T t);
20 class X : I<C>
22 async void I<C>.Foo (C c)
24 await Task.Delay (1);
27 public static int Main ()
29 var m = typeof (X).GetMethod ("N.I<N.C>.Foo", BindingFlags.NonPublic | BindingFlags.Instance);
30 var attr = m.GetCustomAttribute<AsyncStateMachineAttribute> ();
31 if (attr == null)
32 return 1;
34 var assembly = AssemblyDefinition.ReadAssembly (typeof (X).Assembly.Location);
35 foreach (var t in assembly.MainModule.Types) {
36 PrintType (t, 0);
39 return 0;
42 static void PrintType (TypeDefinition td, int indent)
44 if (td.IsNested && !string.IsNullOrEmpty (td.Namespace))
45 throw new ApplicationException ("BROKEN NESTED TYPE:");
46 Console.WriteLine ("{2} Namespace: {0} Name: {1}", td.Namespace, td.Name, new string (' ', indent * 4));
47 foreach (var tn in td.NestedTypes)
48 PrintType (tn, indent + 1);