Share via


HostException Constructors

Definition

Overloads

HostException()

Initializes a new instance of the HostException class.

HostException(String)

Initializes a new instance of the HostException class and defines the error message.

HostException(SerializationInfo, StreamingContext)
Obsolete.

Initializes a new instance of the HostException class and defines the SerializationInfo and the StreamingContext.

HostException(String, Exception)

Initializes a new instance of the HostException class and defines the error message and inner exception.

HostException(String, Exception, String, ErrorCategory)

Initializes a new instance of the HostException class and defines the error message, inner exception, the error ID, and the error category.

HostException()

Initializes a new instance of the HostException class.

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

Applies to

HostException(String)

Initializes a new instance of the HostException class and defines the error message.

public:
 HostException(System::String ^ message);
public:
 HostException(Platform::String ^ message);
 HostException(std::wstring const & message);
public HostException (string message);
new System.Management.Automation.Host.HostException : string -> System.Management.Automation.Host.HostException
Public Sub New (message As String)

Parameters

message
String

The error message that explains the reason for the exception.

Applies to

HostException(SerializationInfo, StreamingContext)

Caution

Legacy serialization support is deprecated since .NET 8

Initializes a new instance of the HostException class and defines the SerializationInfo and the StreamingContext.

protected:
 HostException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected HostException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId="SYSLIB0051")]
protected HostException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Management.Automation.Host.HostException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Management.Automation.Host.HostException
[<System.Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId="SYSLIB0051")>]
new System.Management.Automation.Host.HostException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Management.Automation.Host.HostException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameters

info
SerializationInfo

The object that holds the serialized object data.

context
StreamingContext

The contextual information about the source or destination.

Attributes

Applies to

HostException(String, Exception)

Initializes a new instance of the HostException class and defines the error message and inner exception.

public:
 HostException(System::String ^ message, Exception ^ innerException);
public HostException (string message, Exception innerException);
new System.Management.Automation.Host.HostException : string * Exception -> System.Management.Automation.Host.HostException
Public Sub New (message As String, innerException As Exception)

Parameters

message
String

The error message that explains the reason for the exception.

innerException
Exception

The exception that is the cause of the current exception. If the innerException parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception.

Applies to

HostException(String, Exception, String, ErrorCategory)

Initializes a new instance of the HostException class and defines the error message, inner exception, the error ID, and the error category.

public:
 HostException(System::String ^ message, Exception ^ innerException, System::String ^ errorId, System::Management::Automation::ErrorCategory errorCategory);
public HostException (string message, Exception innerException, string errorId, System.Management.Automation.ErrorCategory errorCategory);
new System.Management.Automation.Host.HostException : string * Exception * string * System.Management.Automation.ErrorCategory -> System.Management.Automation.Host.HostException
Public Sub New (message As String, innerException As Exception, errorId As String, errorCategory As ErrorCategory)

Parameters

message
String

The error message that explains the reason for the exception.

innerException
Exception

The exception that is the cause of the current exception. If the innerException parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception.

errorId
String

The string that should uniquely identifies the situation where the exception is thrown. The string should not contain white space.

errorCategory
ErrorCategory

The ErrorCategory into which this exception situation falls

Remarks

Intentionally public, third-party hosts can call this

Applies to