BadImageFormatException 构造函数

定义

初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class.

重载

BadImageFormatException()

初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class.

BadImageFormatException(String)

用指定的错误消息初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class with a specified error message.

BadImageFormatException(SerializationInfo, StreamingContext)

使用序列化数据初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class with serialized data.

BadImageFormatException(String, Exception)

使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class with a specified error message and a reference to the inner exception that is the cause of this exception.

BadImageFormatException(String, String)

用指定的错误消息和文件名初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class with a specified error message and file name.

BadImageFormatException(String, String, Exception)

使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class with a specified error message and a reference to the inner exception that is the cause of this exception.

BadImageFormatException()

初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class.

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

注解

此构造函数将新实例的 Message 属性初始化为系统提供的描述错误的消息,如 "可执行文件或库的格式无效"。This constructor initializes the Message property of the new instance to a system-supplied message that describes the error, such as "Format of the executable or library is invalid." 此消息会考虑当前系统区域性。This message takes into account the current system culture.

下表显示了 BadImageFormatException 实例的初始属性值。The following table shows the initial property values for an instance of BadImageFormatException.

propertiesProperty Value
InnerException 空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic).
Message 本地化的错误消息字符串。The localized error message string.

BadImageFormatException(String)

用指定的错误消息初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class with a specified error message.

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

参数

message
String

用于描述错误的消息。The message that describes the error.

注解

message 参数的内容应为人所理解。The content of the message parameter is intended to be understood by humans. 此构造函数的调用方需要确保此字符串已针对当前系统区域性进行了本地化。The caller of this constructor is required to ensure that this string has been localized for the current system culture.

下表显示了 BadImageFormatException 实例的初始属性值。The following table shows the initial property values for an instance of BadImageFormatException.

propertiesProperty Value
InnerException 空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic).
Message 错误消息字符串。The error message string.

BadImageFormatException(SerializationInfo, StreamingContext)

使用序列化数据初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class with serialized data.

protected:
 BadImageFormatException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected BadImageFormatException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new BadImageFormatException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> BadImageFormatException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

参数

info
SerializationInfo

包含有关所引发异常的序列化对象数据的 SerializationInfoThe SerializationInfo that holds the serialized object data about the exception being thrown.

context
StreamingContext

包含有关源或目标的上下文信息的 StreamingContextThe StreamingContext that contains contextual information about the source or destination.

注解

在反序列化期间调用此构造函数以重新构造在流上传输的异常对象。This constructor is called during deserialization to reconstitute the exception object transmitted over a stream.

BadImageFormatException(String, Exception)

使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class with a specified error message and a reference to the inner exception that is the cause of this exception.

public:
 BadImageFormatException(System::String ^ message, Exception ^ inner);
public BadImageFormatException (string message, Exception inner);
new BadImageFormatException : string * Exception -> BadImageFormatException
Public Sub New (message As String, inner As Exception)

参数

message
String

用于解释异常原因的错误消息。The error message that explains the reason for the exception.

inner
Exception

导致当前异常的异常。The exception that is the cause of the current exception. 如果 inner 参数不为空引用,则在处理内部异常的 catch 块中引发当前异常。If the inner parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception.

注解

作为前一个异常的直接结果引发的异常应在 InnerException 属性中包含对前一个异常的引用。An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. InnerException 属性将返回传递给构造函数的同一值;如果 null 属性不向构造函数提供内部异常值,则返回 InnerExceptionThe InnerException property returns the same value that is passed into the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.

下表显示了 BadImageFormatException 实例的初始属性值。The following table shows the initial property values for an instance of BadImageFormatException.

propertiesProperty Value
InnerException 内部异常引用。The inner exception reference.
Message 错误消息字符串。The error message string.

另请参阅

BadImageFormatException(String, String)

用指定的错误消息和文件名初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class with a specified error message and file name.

public:
 BadImageFormatException(System::String ^ message, System::String ^ fileName);
public BadImageFormatException (string message, string fileName);
new BadImageFormatException : string * string -> BadImageFormatException
Public Sub New (message As String, fileName As String)

参数

message
String

描述错误的消息。A message that describes the error.

fileName
String

包含无效图像的文件的全名。The full name of the file with the invalid image.

注解

message 参数的内容应为人所理解。The content of the message parameter is intended to be understood by humans. 此构造函数的调用方需要确保此字符串已针对当前系统区域性进行了本地化。The caller of this constructor is required to ensure that this string has been localized for the current system culture.

propertiesProperty Value
FileName 包含无效图像的文件的全名。The full name of the file with the invalid image.
Message 错误消息字符串。The error message string.

BadImageFormatException(String, String, Exception)

使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 BadImageFormatException 类的新实例。Initializes a new instance of the BadImageFormatException class with a specified error message and a reference to the inner exception that is the cause of this exception.

public:
 BadImageFormatException(System::String ^ message, System::String ^ fileName, Exception ^ inner);
public BadImageFormatException (string message, string fileName, Exception inner);
new BadImageFormatException : string * string * Exception -> BadImageFormatException
Public Sub New (message As String, fileName As String, inner As Exception)

参数

message
String

用于解释异常原因的错误消息。The error message that explains the reason for the exception.

fileName
String

包含无效图像的文件的全名。The full name of the file with the invalid image.

inner
Exception

导致当前异常的异常。The exception that is the cause of the current exception. 如果 inner 参数不为 null,则当前异常将在处理内部异常的 catch 块中引发。If the inner parameter is not null, the current exception is raised in a catch block that handles the inner exception.

注解

作为前一个异常的直接结果引发的异常应在 InnerException 属性中包含对前一个异常的引用。An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. InnerException 属性将返回传递给构造函数的同一值;如果 null 属性不向构造函数提供内部异常值,则返回 InnerExceptionThe InnerException property returns the same value that is passed into the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.

下表显示了 BadImageFormatException 实例的初始属性值。The following table shows the initial property values for an instance of BadImageFormatException.

propertiesProperty Value
InnerException 内部异常引用。The inner exception reference.
FileName 包含无效图像的文件的全名。The full name of the file with the invalid image.
Message 错误消息字符串。The error message string.

适用于