static int Test() { GenericIdentity identity = new GenericIdentity("me"); string[] roles = new string [1] { "mono hacker" }; Thread.CurrentPrincipal = new GenericPrincipal(identity, roles); return(LinkDemand.Test()); }
static int Test() { Console.WriteLine("[this should not print - as JIT will reject the LinkDemand]"); GenericIdentity identity = new GenericIdentity("me"); string[] roles = new string [1] { "mono hacker" }; Thread.CurrentPrincipal = new GenericPrincipal(identity, roles); // Note: if the next line is commented then no exception will // be thrown as the JIT will never reach the LinkDemand class return(LinkDemand.Test()); }