System.Runtime.CompilerServices.ContractHelper.TriggerFailure Method

Triggers the default failure behavior.

Syntax

[System.Diagnostics.DebuggerNonUserCode]
[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
public static void TriggerFailure (System.Diagnostics.Contracts.ContractFailureKind kind, string displayMessage, string userMessage, string conditionText, Exception innerException)

Parameters

kind
One of the enumeration values that specifies the type of failure.
displayMessage
The message to display.
userMessage
Additional user information.
conditionText
The description of the condition that caused the failure.
innerException
The inner exception that caused the current exception.

Remarks

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

Requirements

Namespace: System.Runtime.CompilerServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0