ערוך

שתף באמצעות


ContractHelper.TriggerFailure Method

Definition

Triggers the default failure behavior.

public:
 static void TriggerFailure(System::Diagnostics::Contracts::ContractFailureKind kind, System::String ^ displayMessage, System::String ^ userMessage, System::String ^ conditionText, Exception ^ innerException);
public static void TriggerFailure (System.Diagnostics.Contracts.ContractFailureKind kind, string displayMessage, string userMessage, string conditionText, Exception innerException);
public static void TriggerFailure (System.Diagnostics.Contracts.ContractFailureKind kind, string? displayMessage, string? userMessage, string? conditionText, Exception? innerException);
static member TriggerFailure : System.Diagnostics.Contracts.ContractFailureKind * string * string * string * Exception -> unit
Public Shared Sub TriggerFailure (kind As ContractFailureKind, displayMessage As String, userMessage As String, conditionText As String, innerException As Exception)

Parameters

kind
ContractFailureKind

One of the enumeration values that specifies the type of failure.

displayMessage
String

The message to display.

userMessage
String

Additional user information.

conditionText
String

The description of the condition that caused the failure.

innerException
Exception

The inner exception that caused the current exception.

Remarks

The default failure behavior is to raise an Assert, which causes the Assert dialog box to be displayed. You can change that behavior to throw an exception instead of displaying the dialog box.

Applies to