2 using System.Reflection;
4 using System.Security.Permissions;
5 using System.Threading;
9 static void ShowStackTrace (object o)
12 Console.WriteLine ("{0}: {1}", counter, Environment.StackTrace);
15 Console.WriteLine (Assembly.GetExecutingAssembly ().Evidence.Count);
18 catch (SecurityException se) {
20 Console.WriteLine ("EXPECTED SecurityException {0}", se);
22 catch (Exception ex) {
23 Console.WriteLine ("UNEXPECTED {0}", ex);
33 static int counter = 0;
34 static int result = 0;
37 // this Deny will prevent the Assembly.Evidence property from working
38 [SecurityPermission (SecurityAction.Deny, ControlEvidence = true)]
39 static int Main (string[] args)
41 debug = (args.Length > 0);
43 SecurityManager.SecurityEnabled = (args [0] != "off");
46 ShowStackTrace (null);
48 TimerCallback cb = new TimerCallback (ShowStackTrace);
49 t = new Timer (cb, null, 500, 1000);