ContractHelper.TriggerFailure Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Triggers the default failure behavior.
Namespace: System.Diagnostics.Contracts.Internal
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
<DebuggerNonUserCodeAttribute> _
Public Shared Sub TriggerFailure ( _
kind As ContractFailureKind, _
displayMessage As String, _
userMessage As String, _
conditionText As String, _
innerException As Exception _
)
[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.
Remarks
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.
Version Information
Silverlight
Supported in: 5, 4
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.