using System;
+using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Timers;
Console.WriteLine ("{0}: {1}", counter, Environment.StackTrace);
try {
- Environment.Exit (1);
+ Console.WriteLine (Assembly.GetExecutingAssembly ().Evidence.Count);
+ result = 1;
}
catch (SecurityException se) {
if (debug)
Console.WriteLine ("EXPECTED SecurityException {0}", se);
}
+ catch (Exception ex) {
+ Console.WriteLine ("UNEXPECTED {0}", ex);
+ result = 1;
+ }
if (counter++ > 5) {
t.AutoReset = false;
static bool debug;
static int counter = 0;
+ static int result = 0;
static Timer t;
- // this Deny will prevent Environment.Exit from working
- [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
+ // this Deny will prevent the Assembly.Evidence property from working
+ [SecurityPermission (SecurityAction.Deny, ControlEvidence = true)]
static int Main (string[] args)
{
debug = (args.Length > 0);
t.Enabled = true;
System.Threading.Thread.Sleep (5000);
- return 0;
+ return result;
}
}