3 using System.Security.Permissions;
4 using System.Security.Principal;
5 using System.Threading;
9 [PrincipalPermission (SecurityAction.LinkDemand, Authenticated=false)]
10 static int LinkDemand ()
12 Console.WriteLine ("*0* [this should print]");
18 Console.WriteLine ("[this should print - as JIT will accept the unauthenticated LinkDemand]");
20 GenericIdentity identity = new GenericIdentity ("me");
21 string[] roles = new string [1] { "mono hacker" };
22 Thread.CurrentPrincipal = new GenericPrincipal (identity, roles);
28 static int Main (string[] args)
33 catch (SecurityException se) {
34 Console.WriteLine ("*1* Unexpected SecurityException\n{0}", se);
38 Console.WriteLine ("*2* Unexpected Exception\n{0}", e);