ContractHelper.RaiseContractFailedEvent(ContractFailureKind, String, String, Exception) Método

Definição

Usado pelo reescritor binário para ativar o comportamento de falha padrão.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

Parâmetros

failureKind
ContractFailureKind

O tipo de falha.The type of failure.

userMessage
String

Informações de usuário adicionais.Additional user information.

conditionText
String

A descrição da condição que causou a falha.The description of the condition that caused the failure.

innerException
Exception

A exceção interna que causou a exceção atual.The inner exception that caused the current exception.

Retornos

String

Uma referência nula (Nothing no Visual Basic) se o evento foi manipulado e não deve disparar uma falha, caso contrário, retorna a mensagem de falha localizada.A null reference (Nothing in Visual Basic) if the event was handled and should not trigger a failure; otherwise, returns the localized failure message.

Exceções

failureKind não é um valor ContractFailureKind válido.failureKind is not a valid ContractFailureKind value.

Comentários

O regravador binário chama esse método para notificar os ouvintes sobre uma falha de contrato.The binary rewriter calls this method to notify listeners about a contract failure. O RaiseContractFailedEvent método não executa o comportamento de falha (um Assert ou throw) em si.The RaiseContractFailedEvent method does not perform the failure behavior (an assert or throw) itself. Se a falha for tratada pelos ouvintes, o método retornará null .If the failure is handled by the listeners, the method returns null. Se a falha não for tratada pelos ouvintes, uma mensagem de falha localizada será retornada.If the failure is not handled by the listeners, a localized failure message is returned.

Aplica-se a