Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
TriggerFailure Method
Collapse the table of content
Expand the table of content

ContractHelper.TriggerFailure Method

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


Type: System.Diagnostics.Contracts.ContractFailureKind

The type of failure.

Type: System.String

The message to display.

Type: System.String

Additional user information.

Type: System.String

The description of the condition that caused the failure.

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

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library
© 2015 Microsoft