ContractHelper.TriggerFailure Method (ContractFailureKind, String, String, String, Exception)

 

Triggers the default failure behavior.

Namespace:   System.Diagnostics.Contracts.Internal
Assembly:  mscorlib (in mscorlib.dll)

public static void TriggerFailure(
	ContractFailureKind kind,
	string displayMessage,
	string userMessage,
	string conditionText,
	Exception innerException
)

Parameters

kind
Type: System.Diagnostics.Contracts.ContractFailureKind

The type of failure.

displayMessage
Type: System.String

The message to display.

userMessage
Type: System.String

Additional user information.

conditionText
Type: System.String

The description of the condition that caused the failure.

innerException
Type: System.Exception

The inner exception that caused the current exception.

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.

.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Return to top
Show: