Open sandboxFocus

Class InvariantViolationException

An exception that should be thrown by the target methods of the InvariantAttribute aspect when an invariant condition is violated.

Inheritance
InvariantViolationException
Implements
Namespace: Metalama.Patterns.Contracts
Assembly: Metalama.Patterns.Contracts.dll
Syntax
public class InvariantViolationException : ApplicationException, ISerializable
Remarks

Methods marked with InvariantAttribute are automatically called after public or internal methods complete. When an invariant method detects an inconsistent state, it should throw this exception to indicate the contract violation.

Constructors

Name Description
InvariantViolationException()

Initializes a new instance of the InvariantViolationException class.

InvariantViolationException(string)

Initializes a new instance of the InvariantViolationException class with a specified error message.

InvariantViolationException(string, Exception)

Initializes a new instance of the InvariantViolationException class with a specified error message and a reference to the inner exception that is the cause of this exception.

Extension Methods

See Also