This documentation is archived and is not being maintained.

ValidationException Class

Updated: July 2008

Represents the exception that occurs during validation of a data field when the ValidationAttribute class is used.

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

public class ValidationException : Exception

A validation exception occurs if an input value does not match the expected data type, range or pattern of the data field. For example, validating an integer value in a data field that expects a DateTime value causes a validation exception. You can provide custom validation logic in a LINQ to SQL class to enforce validations.

This class uses the ValidationAttribute class to customize validations. A ValidationException is thrown if a validation error occurs. The exception is thrown when the Validate method is called. All the exceptions that are thrown during validation are contained in the InnerExceptions collection. You can retrieve each validation exception by iterating through the InnerExceptions collection.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5 SP1




July 2008

Added topic for new class.

SP1 feature change.