Watch EntityValidationErrors in Entity Framework

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 use the following expression:

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