+ // do we check for execution rights ?
+ if (CheckExecutionRights) {
+ bool execute = false;
+ // an empty permissionset doesn't include Execution
+ if (resolved != null) {
+ // unless we have "Full Trust"...
+ if (resolved.IsUnrestricted ()) {
+ execute = true;
+ } else {
+ // ... we need to find a SecurityPermission
+ IPermission security = resolved.GetPermission (typeof (SecurityPermission));
+ execute = _execution.IsSubsetOf (security);
+ }
+ }
+
+ if (!execute) {
+ throw new PolicyException (Locale.GetText (
+ "Policy doesn't grant the right to execute the assembly."));
+ }
+ }
+