private static bool CheckDynamicMethodSetHelper(DynamicResolver dynamicResolver, PermissionSet demandSet, out PermissionSet alteredDemandSet, RuntimeMethodHandleInternal rmh) { CompressedStack securityContext = dynamicResolver.GetSecurityContext(); try { return(securityContext.CheckSetDemandWithModificationNoHalt(demandSet, out alteredDemandSet, rmh)); } catch (SecurityException ex) { throw new SecurityException(Environment.GetResourceString("Security_AnonymouslyHostedDynamicMethodCheckFailed"), (Exception)ex); } }