Open sandboxFocus

Class ContractExceptionInfo

Holds the information from which the ContractExceptionFactory should create the exception.

Inheritance
ContractExceptionInfo
Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
Syntax
public class ContractExceptionInfo
Remarks

A custom contract creates an instance of this class and passes it to the CreateException(ContractExceptionInfo) method of ExceptionFactory. The MessageId must be known by LocalizedTextProvider, or the default factory throws an exception when it formats the message. The identifiers of the messages of built-in contracts are the constants of ContractLocalizedTextProvider.

Constructors

Name Description
ContractExceptionInfo(Type, LocationContractAttribute, object, string, LocationKind, LocationValidationContext, string, object[])

Initializes a new instance of the ContractExceptionInfo class.

Properties

Name Description
Aspect

Gets the aspect that requested the exception.

Context

Gets the context of the location validation.

ExceptionType

Gets the type of the exception that should be created.

LocationKind

Gets the kind of the location.

LocationName

Gets the name of the location.

MessageArguments

Gets the additional parameters to be used in the exception message formatting.

MessageId

Gets the identifier of the error message to be used in the exception message formatting.

Value

Gets the value being assigned to the location.

See Also