Hossein Zahed

Web Developer, Entrepreneur, Software Educator

How to view EntityValidationErrors in Visual Studio

If Entity Framework throws a validation exception when saving, Visual Studio reports the message, Validation failed for one or more entities. See "EntityValidationErrors" property for more details. But the in-built "View Detail" dialog doesn’t let you drill into the EntityValidationErrors property. To view the EntityValidationErrors collection, add the following Watch expression to the Watch window (Ctrl + Alt + Q)

((System.Data.Entity.Validation.DbEntityValidationException)$exception).EntityValidationErrors