ContractHelper.TriggerFailure(ContractFailureKind, String, String, String, Exception) ContractHelper.TriggerFailure(ContractFailureKind, String, String, String, Exception) ContractHelper.TriggerFailure(ContractFailureKind, String, String, String, Exception) ContractHelper.TriggerFailure(ContractFailureKind, String, String, String, Exception) 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);
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

displayMessage
String String String String

The message to display.

userMessage
String String String String

Additional user information.

conditionText
String String String String

The description of the condition that caused the failure.

innerException
Exception Exception Exception 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