Merge pull request #980 from StephenMcConnel/bug-18638
[mono.git] / mcs / tests / test-async-76.cs
1 // Compiler options: -r:../class/lib/net_4_5/Mono.Cecil.dll
2
3 using System;
4 using System.Threading.Tasks;
5 using Mono.Cecil;
6
7 namespace N
8 {
9         class C
10         {
11         }
12
13         interface I<T>
14         {
15                 void Foo (T t);
16         }
17
18         class X : I<C>
19         {
20                 async void I<C>.Foo (C c)
21                 {
22                         await Task.Delay (1);
23                 }
24
25                 public static void Main ()
26                 {
27                         var assembly = AssemblyDefinition.ReadAssembly (typeof (X).Assembly.Location);
28                         foreach (var t in assembly.MainModule.Types) {
29                                 PrintType (t, 0);
30                         }
31                 }
32  
33                 static void PrintType (TypeDefinition td, int indent)
34                 {
35                         if (td.IsNested && !string.IsNullOrEmpty (td.Namespace))
36                                 throw new ApplicationException ("BROKEN NESTED TYPE:");
37                         Console.WriteLine ("{2} Namespace: {0} Name: {1}", td.Namespace, td.Name, new string (' ', indent * 4));
38                         foreach (var tn in td.NestedTypes)
39                                 PrintType (tn, indent + 1);
40                 }
41         }
42 }