HostProtectionException 构造函数

定义

初始化 HostProtectionException 类的新实例。

重载

HostProtectionException()

使用默认值初始化 HostProtectionException 类的新实例。

HostProtectionException(String)

用指定的错误消息初始化 HostProtectionException 类的新实例。

HostProtectionException(SerializationInfo, StreamingContext)
已过时.

使用提供的序列化信息和流上下文初始化 HostProtectionException 类的新实例。

HostProtectionException(String, Exception)

使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 HostProtectionException 类的新实例。

HostProtectionException(String, HostProtectionResource, HostProtectionResource)

用指定的错误消息、受保护的主机资源和导致引发异常的主机资源初始化 HostProtectionException 类的新实例。

HostProtectionException()

Source:
HostProtectionException.cs
Source:
HostProtectionException.cs
Source:
HostProtectionException.cs

使用默认值初始化 HostProtectionException 类的新实例。

public:
 HostProtectionException();
public HostProtectionException ();
Public Sub New ()

注解

下表显示 HostProtectionException 类的实例的初始属性值。

属性
ProtectedResources HostProtectionResource.None
DemandedResources HostProtectionResource.None

适用于

HostProtectionException(String)

Source:
HostProtectionException.cs
Source:
HostProtectionException.cs
Source:
HostProtectionException.cs

用指定的错误消息初始化 HostProtectionException 类的新实例。

public:
 HostProtectionException(System::String ^ message);
public HostProtectionException (string message);
new System.Security.HostProtectionException : string -> System.Security.HostProtectionException
Public Sub New (message As String)

参数

message
String

描述错误的消息。

注解

用户应可理解 参数的内容 message 。 此构造函数的调用方需要确保此字符串已针对当前系统区域性进行了本地化。

适用于

HostProtectionException(SerializationInfo, StreamingContext)

Source:
HostProtectionException.cs
Source:
HostProtectionException.cs
Source:
HostProtectionException.cs

注意

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

使用提供的序列化信息和流上下文初始化 HostProtectionException 类的新实例。

protected:
 HostProtectionException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected HostProtectionException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected HostProtectionException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Security.HostProtectionException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.HostProtectionException
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.HostProtectionException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.HostProtectionException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

参数

info
SerializationInfo

承载序列化对象数据的对象。

context
StreamingContext

有关源或目标的上下文信息。

属性

例外

info 上声明的默认值为 null

注解

在反序列化过程中调用此构造函数以重新构造通过流传输的异常对象。

适用于

HostProtectionException(String, Exception)

Source:
HostProtectionException.cs
Source:
HostProtectionException.cs
Source:
HostProtectionException.cs

使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 HostProtectionException 类的新实例。

public:
 HostProtectionException(System::String ^ message, Exception ^ e);
public HostProtectionException (string message, Exception e);
new System.Security.HostProtectionException : string * Exception -> System.Security.HostProtectionException
Public Sub New (message As String, e As Exception)

参数

message
String

解释异常原因的错误消息。

e
Exception

导致当前异常的异常。 如果 innerException 参数不为 null,则当前异常将在处理内部异常的 catch 块中引发。

注解

因前一个异常而直接引发的异常可以在 InnerException 属性中包含对前一个异常的引用。 InnerException 属性将返回传递给构造函数的同一值;如果 InnerException 属性不向构造函数提供内部异常值,则返回 null

适用于

HostProtectionException(String, HostProtectionResource, HostProtectionResource)

Source:
HostProtectionException.cs
Source:
HostProtectionException.cs
Source:
HostProtectionException.cs

用指定的错误消息、受保护的主机资源和导致引发异常的主机资源初始化 HostProtectionException 类的新实例。

public:
 HostProtectionException(System::String ^ message, System::Security::Permissions::HostProtectionResource protectedResources, System::Security::Permissions::HostProtectionResource demandedResources);
public HostProtectionException (string message, System.Security.Permissions.HostProtectionResource protectedResources, System.Security.Permissions.HostProtectionResource demandedResources);
new System.Security.HostProtectionException : string * System.Security.Permissions.HostProtectionResource * System.Security.Permissions.HostProtectionResource -> System.Security.HostProtectionException
Public Sub New (message As String, protectedResources As HostProtectionResource, demandedResources As HostProtectionResource)

参数

message
String

解释异常原因的错误消息。

protectedResources
HostProtectionResource

枚举值的按位组合,这些值指定部分受信任的代码不可访问的主机资源。

demandedResources
HostProtectionResource

枚举值的按位组合,这些值指定所需的主机资源。

注解

参数 demandedResources 指定导致引发异常的所需主机保护类别。 例如,假设某个方法具有一个 HostProtectionAttribute 属性,该属性指示该方法公开共享状态。 调用 方法时, HostProtectionAttribute 将执行共享状态的链接需求。 如果主机已将共享状态设置为禁止的类别,则会HostProtectionException引发 ,其属性值HostProtectionResource.SharedStatedemandedResources

适用于