3 namespace InternalsVisibleTo {
5 static void Main (string[] args) {
8 Console.WriteLine("-- Correct case --");
11 var a = new CorrectCaseFriendAssembly.InternalClass(@private: false);
12 Console.WriteLine("Access internal class private ctor: OK");
13 // Microsoft behaves this way
14 } catch (MemberAccessException) {
15 Console.WriteLine("Access internal class private ctor: Fail");
16 // FIXME: Mono behaves this way
21 var a = new CorrectCaseFriendAssembly.InternalClass(@internal: 0);
22 Console.WriteLine("Access internal class internal ctor: OK");
23 } catch (MemberAccessException) {
25 Console.WriteLine("Access friend internal ctor: Fail");
29 var b = new CorrectCaseFriendAssembly.InternalClass(@public: 'a');
30 Console.WriteLine("Access internal class public ctor: OK");
32 Console.WriteLine("Access friend internal method: OK");
33 } catch (MemberAccessException) {
35 Console.WriteLine("Access friend internal method with wrong case: Fail");
38 Console.WriteLine("-- Wrong case --");
41 var a = new WrongCaseFriendAssembly.InternalClass(@private: false);
42 // Microsoft behaves this way
43 Console.WriteLine("Access internal class private ctor: OK");
44 } catch (MemberAccessException) {
45 // FIXME: Mono behaves this way
46 Console.WriteLine("Access internal class private ctor: Fail");
51 var a = new WrongCaseFriendAssembly.InternalClass(@internal: 0);
52 Console.WriteLine("Access internal class internal ctor: OK");
53 } catch (MemberAccessException) {
55 Console.WriteLine("Access friend internal ctor: Fail");
59 var b = new WrongCaseFriendAssembly.InternalClass(@public: 'a');
60 Console.WriteLine("Access internal class public ctor: OK");
62 Console.WriteLine("Access friend internal method: OK");
63 } catch (MemberAccessException) {
65 Console.WriteLine("Access friend internal method: Fail");
69 // Surprisingly this works in the Windows CLR, even though it seems like it shouldn't
70 WrongCaseFriendAssembly.InternalClass.PrivateStaticMethod();
71 Console.WriteLine("Access friend private static method: OK");
72 } catch (MemberAccessException) {
73 Console.WriteLine("Access friend private static method: Fail");
78 WrongCaseFriendAssembly.InternalClass.InternalStaticMethod();
79 Console.WriteLine("Access friend internal static method: OK");
80 } catch (MemberAccessException) {
82 Console.WriteLine("Access friend internal static method: Fail");
86 WrongCaseFriendAssembly.PublicClass.InternalStaticMethod();
87 Console.WriteLine("Access public internal static method: OK");
88 } catch (MemberAccessException) {
90 Console.WriteLine("Access public internal static method: Fail");
93 if (System.Diagnostics.Debugger.IsAttached)
96 Console.WriteLine("Incorrect results: {0}", failCount);
97 Environment.ExitCode = failCount;