Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / reflection-load-with-context.cs
1 using System;
2 using System.Reflection;
3 using System.IO;
4
5 class Driver {
6         static int Main () {
7                 var src = Path.GetDirectoryName (typeof (Driver).Assembly.Location);
8                 var dep_asm = Assembly.UnsafeLoadFrom (Path.Combine (src, "reflection-load-with-context-lib.dll"));
9                 var type = dep_asm.GetType ("B.ClassB");
10                 var attr_type = dep_asm.GetType ("B.MyAttribute");
11
12                 try {
13                         Activator.CreateInstance (type);
14                 } catch (Exception) {
15                         return 1;
16                 }
17
18                 try {
19                         type.GetCustomAttributes (attr_type, false);
20                 } catch (Exception) {
21                         return 2;
22                 }
23                 return 0;
24         }
25 }
26