TriggerFailure Method
Collapse the table of content
Expand the table of content

ContractHelper.TriggerFailure Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Triggers the default failure behavior.

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

'Declaration
Public Shared Sub TriggerFailure ( _
	kind As ContractFailureKind, _
	displayMessage As String, _
	userMessage As String, _
	conditionText As String, _
	innerException As Exception _
)

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.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft