ContractHelper.RaiseContractFailedEvent(ContractFailureKind, String, String, Exception) ContractHelper.RaiseContractFailedEvent(ContractFailureKind, String, String, Exception) ContractHelper.RaiseContractFailedEvent(ContractFailureKind, String, String, Exception) ContractHelper.RaiseContractFailedEvent(ContractFailureKind, String, String, Exception) Method

Definition

Used by the binary rewriter to activate the default failure behavior.

public:
 static System::String ^ RaiseContractFailedEvent(System::Diagnostics::Contracts::ContractFailureKind failureKind, System::String ^ userMessage, System::String ^ conditionText, Exception ^ innerException);
public static string RaiseContractFailedEvent (System.Diagnostics.Contracts.ContractFailureKind failureKind, string userMessage, string conditionText, Exception innerException);
static member RaiseContractFailedEvent : System.Diagnostics.Contracts.ContractFailureKind * string * string * Exception -> string
Public Shared Function RaiseContractFailedEvent (failureKind As ContractFailureKind, userMessage As String, conditionText As String, innerException As Exception) As String

Parameters

userMessage
String String String String

Additional user information.

conditionText
String String String String

The description of the condition that caused the failure.

innerException
Exception Exception Exception Exception

The inner exception that caused the current exception.

Returns

A null reference (Nothing in Visual Basic) if the event was handled and should not trigger a failure; otherwise, returns the localized failure message.

Exceptions

Remarks

The binary rewriter calls this method to notify listeners about a contract failure. The RaiseContractFailedEvent method does not perform the failure behavior (an assert or throw) itself. If the failure is handled by the listeners, the method returns null. If the failure is not handled by the listeners, a localized failure message is returned.

Applies to