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)

[DebuggerNonUserCodeAttribute]
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

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft