2 using System.Reflection;
4 using System.Security.Permissions;
5 using System.Windows.Forms;
9 static void ShowStackTrace (object o, EventArgs e)
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);
32 static int result = 0;
34 // this Deny will prevent the Assembly.Evidence property from working
35 [SecurityPermission (SecurityAction.Deny, ControlEvidence = true)]
36 static int Main (string[] args)
38 debug = (args.Length > 0);
40 SecurityManager.SecurityEnabled = (args [0] != "off");
43 if (SecurityManager.SecurityEnabled) {
44 Console.WriteLine ("SecurityManager.SecurityEnabled: true");
45 ShowStackTrace (null, null);
47 Console.WriteLine ("SecurityManager.SecurityEnabled: false");
50 Timer t = new Timer ();
51 t.Tick += new EventHandler (ShowStackTrace);
56 Application.DoEvents ();