Table of Contents

Class ArgumentValidationException

Namespace
Acuit.Pinpoint.Common.Validation
Assembly
Acuit.Pinpoint.Common.dll

The exception that is thrown when an argument fails validation.

public class ArgumentValidationException : ArgumentException, ISerializable
Inheritance
ArgumentValidationException
Implements
Inherited Members
Extension Methods

Constructors

ArgumentValidationException()

Initializes a new instance of ArgumentValidationException.

public ArgumentValidationException()

ArgumentValidationException(IDictionary<string, string[]>, string?)

Initializes a new instance of ArgumentValidationException with a set of validation errors and the parameter name.

public ArgumentValidationException(IDictionary<string, string[]> errors, string? paramName)

Parameters

errors IDictionary<string, string[]>

The set of validation errors.

paramName string

The name of the parameter that caused the current exception.

Exceptions

ArgumentNullException

errors is null.

ArgumentValidationException(IEnumerable<KeyValuePair<string, string[]>>, string?)

Initializes a new instance of ArgumentValidationException with a set of validation errors and the parameter name.

public ArgumentValidationException(IEnumerable<KeyValuePair<string, string[]>> errors, string? paramName)

Parameters

errors IEnumerable<KeyValuePair<string, string[]>>

The set of validation errors.

paramName string

The name of the parameter that caused the current exception.

Exceptions

ArgumentNullException

errors is null.

ArgumentValidationException(IEnumerable<ValidationResult>, string?)

Initializes a new instance of ArgumentValidationException with validation errors generated from a list of validation results and the parameter name.

public ArgumentValidationException(IEnumerable<ValidationResult> validationResults, string? paramName)

Parameters

validationResults IEnumerable<ValidationResult>

The list of validation results.

paramName string

The name of the parameter that caused the current exception.

Exceptions

ArgumentNullException

validationResults is null.

ArgumentValidationException(string)

Initializes a new instance of ArgumentValidationException with a specified error message.

public ArgumentValidationException(string message)

Parameters

message string

The message that describes the error.

ArgumentValidationException(string?, IDictionary<string, string[]>, string?)

Initializes a new instance of ArgumentValidationException with a specified error message, a set of validation errors, and the parameter name.

public ArgumentValidationException(string? message, IDictionary<string, string[]> errors, string? paramName)

Parameters

message string

The message that describes the error.

errors IDictionary<string, string[]>

The set of validation errors.

paramName string

The name of the parameter that caused the current exception.

Exceptions

ArgumentNullException

errors is null.

ArgumentValidationException(string?, IEnumerable<KeyValuePair<string, string[]>>, string?)

Initializes a new instance of ArgumentValidationException with a specified error message, a set of validation errors, and the parameter name.

public ArgumentValidationException(string? message, IEnumerable<KeyValuePair<string, string[]>> errors, string? paramName)

Parameters

message string

The message that describes the error.

errors IEnumerable<KeyValuePair<string, string[]>>

The set of validation errors.

paramName string

The name of the parameter that caused the current exception.

Exceptions

ArgumentNullException

errors is null.

ArgumentValidationException(string?, IEnumerable<ValidationResult>, string?)

Initializes a new instance of ArgumentValidationException with a specified error message, validation errors generated from a list of validation results, and the parameter name.

public ArgumentValidationException(string? message, IEnumerable<ValidationResult> validationResults, string? paramName)

Parameters

message string

The message that describes the error.

validationResults IEnumerable<ValidationResult>

The list of validation results.

paramName string

The name of the parameter that caused the current exception.

Exceptions

ArgumentNullException

validationResults is null.

ArgumentValidationException(string, Exception)

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

public ArgumentValidationException(string message, Exception inner)

Parameters

message string

The message that describes the error.

inner Exception

The exception that is the cause of the current exception, or null if no inner exception is specified.

ArgumentValidationException(string?, string?)

Initializes a new instance of ArgumentValidationException with a specified error message and the name of the parameter that causes this exception.

public ArgumentValidationException(string? message, string? paramName)

Parameters

message string

The error message that explains the reason for the exception.

paramName string

The name of the parameter that caused the current exception.

ArgumentValidationException(string?, string?, Exception?)

Initializes a new instance of ArgumentValidationException with a specified error message, the parameter name, and a reference to the inner exception that is the cause of this exception.

public ArgumentValidationException(string? message, string? paramName, Exception? innerException)

Parameters

message string

The error message that explains the reason for the exception.

paramName string

The name of the parameter that caused the current exception.

innerException Exception

The exception that is the cause of the current exception. If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception.

ArgumentValidationException(string, string, string?)

Initializes a new instance of ArgumentValidationException with a single validation error and the parameter name.

public ArgumentValidationException(string key, string errorMessage, string? paramName)

Parameters

key string

The key of the entry.

errorMessage string

The error message.

paramName string

The name of the parameter that caused the current exception.

ArgumentValidationException(string?, string, string, string?)

Initializes a new instance of ArgumentValidationException with a specified error message, a single validation error, and the parameter name.

public ArgumentValidationException(string? message, string key, string errorMessage, string? paramName)

Parameters

message string

The message that describes the error.

key string

The key of the entry.

errorMessage string

The error message.

paramName string

The name of the parameter that caused the current exception.

Properties

Errors

Gets the validation errors.

public IDictionary<string, string[]> Errors { get; }

Property Value

IDictionary<string, string[]>

Methods

ThrowIfNotValid(object?, string?)

Validates argument using RecursiveValidator and throws an ArgumentNullException if it is null or an ArgumentValidationException if it is not valid.

public static void ThrowIfNotValid(object? argument, string? paramName = null)

Parameters

argument object

The argument to validate.

paramName string

The name of the parameter with which argument corresponds.