Merge pull request #5428 from kumpera/wasm-support-p2
[mono.git] / mono / tests / bug-81691.cs
1 using System;
2 using System.IO;
3 using System.Reflection;
4
5 class Program
6 {
7         static int Main ()
8         {
9                 string assemblyFile = Path.Combine (AppDomain.CurrentDomain.BaseDirectory, "bug-81691-b.dll");
10                 Assembly assembly = Assembly.LoadFile (assemblyFile);
11                 int i;
12                 int numExceptions = 0;
13
14                 for (i = 0; i < 100000; ++i) {
15                         try {
16                                 try {
17                                         Type type = assembly.GetType ("NS.B.TestB");
18                                         FieldInfo field =type.GetField ("testb", BindingFlags.NonPublic | BindingFlags.Static);
19                                         if (field.FieldType == null)
20                                                 return 1;
21                                 } catch (TypeLoadException ex) {
22                                         ++numExceptions;
23                                 }
24                         } catch (FileNotFoundException ex) {
25                                 ++numExceptions;
26                         }
27                 }
28
29                 if (numExceptions == 100000)
30                         return 0;
31                 return 1;
32         }
33 }