ContractHelper::TriggerFailure Method (ContractFailureKind, String^, String^, String^, Exception^)

.NET Framework (current version)
 

Triggers the default failure behavior.

Namespace:   System.Runtime.CompilerServices
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

One of the enumeration values that specifies 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.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show: