DbEntityValidationException – How can I easily tell what caused the error?

I have a project that uses Entity Framework. While calling SaveChanges on my DbContext, I get the following exception:

System.Data.Entity.Validation.DbEntityValidationException: Validation
failed for one or more entities. See ‘EntityValidationErrors’ property
for more details.

This is all fine and dandy, but I don’t want to attach a debugger every time this exception occurs. More over, in production environments I cannot easily attach a debugger so I have to go to great lengths to reproduce these errors.

How can I see the details hidden within the DbEntityValidationException?

9 Answers
9

Leave a Comment