4 using System
.Reflection
;
5 [assembly
: AssemblyDelaySign(true)]
6 [assembly
: AssemblyKeyFile(@"internalsvisibleto-2048.snk")]
9 namespace InternalsVisibleTo
{
11 static void Main (string[] args
) {
14 Console
.WriteLine("-- Correct case --");
17 var a
= new CorrectCaseFriendAssembly
.PublicClass ();
19 Console
.WriteLine ("Access friend internal method: OK");
20 } catch (MemberAccessException
) {
22 Console
.WriteLine ("Access friend internal method: Fail");
26 var a
= new CorrectCaseFriendAssembly
.InternalClass(@internal: 0);
27 Console
.WriteLine("Access internal class internal ctor: OK");
28 } catch (MemberAccessException
) {
30 Console
.WriteLine("Access friend internal ctor: Fail");
33 Console
.WriteLine("-- Wrong case --");
36 var a
= new WrongCaseFriendAssembly
.InternalClass(@internal: 0);
37 Console
.WriteLine("Access internal class internal ctor: OK");
38 } catch (MemberAccessException
) {
40 Console
.WriteLine("Access friend internal ctor: Fail");
44 // This also works in the Windows CLR. Huh.
45 WrongCaseFriendAssembly
.InternalClass
.PrivateStaticMethod();
46 Console
.WriteLine("Access friend private static method: OK");
47 } catch (MemberAccessException
) {
48 Console
.WriteLine("Access friend private static method: Fail");
53 WrongCaseFriendAssembly
.InternalClass
.InternalStaticMethod();
54 Console
.WriteLine("Access friend internal static method: OK");
55 } catch (MemberAccessException
) {
57 Console
.WriteLine("Access friend internal static method: Fail");
61 WrongCaseFriendAssembly
.PublicClass
.InternalStaticMethod();
62 Console
.WriteLine("Access public internal static method: OK");
63 } catch (MemberAccessException
) {
65 Console
.WriteLine("Access public internal static method: Fail");
68 if (System
.Diagnostics
.Debugger
.IsAttached
)
71 Console
.WriteLine("Incorrect results: {0}", failCount
);
72 Environment
.ExitCode
= failCount
;