// Called from the VM to create a HP Exception private HostProtectionException(HostProtectionResource protectedResources, HostProtectionResource demandedResources) : base(SecurityException.GetResString("HostProtection_HostProtection")) { SetErrorCode(__HResults.COR_E_HOSTPROTECTION); m_protected = protectedResources; m_demanded = demandedResources; }
internal static Exception MakeSecurityException(AssemblyName asmName, Evidence asmEvidence, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, object demand, IPermission permThatFailed) { HostProtectionPermission protectionPermission = permThatFailed as HostProtectionPermission; if (protectionPermission != null) { return((Exception) new HostProtectionException(SecurityException.GetResString("HostProtection_HostProtection"), HostProtectionPermission.protectedResources, protectionPermission.Resources)); } string message = ""; MethodInfo method = (MethodInfo)null; try { message = granted != null || refused != null || demand != null ? (demand == null || !(demand is IPermission) ? (permThatFailed == null ? SecurityException.GetResString("Security_GenericNoType") : string.Format((IFormatProvider)CultureInfo.InvariantCulture, SecurityException.GetResString("Security_Generic"), (object)permThatFailed.GetType().AssemblyQualifiedName)) : string.Format((IFormatProvider)CultureInfo.InvariantCulture, SecurityException.GetResString("Security_Generic"), (object)demand.GetType().AssemblyQualifiedName)) : SecurityException.GetResString("Security_NoAPTCA"); method = SecurityRuntime.GetMethodInfo(rmh); } catch (Exception ex) { if (ex is ThreadAbortException) { throw; } } return((Exception) new SecurityException(message, asmName, granted, refused, method, action, demand, permThatFailed, asmEvidence)); }
private HostProtectionException(HostProtectionResource protectedResources, HostProtectionResource demandedResources) : base(SecurityException.GetResString("HostProtection_HostProtection")) { this.SetErrorCode(-2146232768); this.m_protected = protectedResources; this.m_demanded = demandedResources; }
internal SecurityException(PermissionSet grantedSetObj, PermissionSet refusedSetObj) : base(SecurityException.GetResString("Arg_SecurityException")) { PermissionSet.s_fullTrust.Assert(); this.SetErrorCode(-2146233078); if (grantedSetObj != null) { this.m_granted = grantedSetObj.ToXml().ToString(); } if (refusedSetObj == null) { return; } this.m_refused = refusedSetObj.ToXml().ToString(); }
private void ToStringHelper(StringBuilder sb, string resourceString, object attr) { if (attr == null) { return; } string str = attr as string ?? attr.ToString(); if (str.Length == 0) { return; } sb.Append(Environment.NewLine); sb.Append(SecurityException.GetResString(resourceString)); sb.Append(Environment.NewLine); sb.Append(str); }
public SecurityException() : base(SecurityException.GetResString("Arg_SecurityException")) { this.SetErrorCode(-2146233078); }