2 using System.Reflection;
4 using System.Security.Permissions;
6 using System.Windows.Forms;
10 static void ShowStackTrace (object o, ElapsedEventArgs e)
13 Console.WriteLine ("{0}: {1}", counter, Environment.StackTrace);
16 Console.WriteLine (Assembly.GetExecutingAssembly ().Evidence.Count);
19 catch (SecurityException se) {
21 Console.WriteLine ("EXPECTED SecurityException {0}", se);
23 catch (Exception ex) {
24 Console.WriteLine ("UNEXPECTED {0}", ex);
35 static int counter = 0;
36 static int result = 0;
37 static System.Timers.Timer t;
39 // this Deny will prevent the Assembly.Evidence property from working
40 [SecurityPermission (SecurityAction.Deny, ControlEvidence = true)]
41 static int Main (string[] args)
43 debug = (args.Length > 0);
45 SecurityManager.SecurityEnabled = (args [0] != "off");
48 if (SecurityManager.SecurityEnabled) {
49 Console.WriteLine ("SecurityManager.SecurityEnabled: true");
50 ShowStackTrace (null, null);
52 Console.WriteLine ("SecurityManager.SecurityEnabled: false");
55 Label label = new Label ();
57 t = new System.Timers.Timer (500);
58 t.SynchronizingObject = label;
59 t.Elapsed += new ElapsedEventHandler (ShowStackTrace);
63 // Mono SWF async support requires the message loop in action
65 Application.DoEvents ();