How can I get a list of errors in the immediate window when this breaks in VS 2012
Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
there doesn't appear to be a simple way of displaying them without creating some code modifications to loop through them like so:
foreach (var failure in ex.EntityValidationErrors)
{
string validationErrors="";
foreach (var error in failure.ValidationErrors)
{
validationErrors+=error.PropertyName+" "+error.ErrorMessage;
}
}
((System.Data.Entity.Validation.DbEntityValidationException)$exception)
in the Watch window will give you access to the exception instance. You can check out the error collection from there.
I keep that available in my Watch list so I can just refresh if I run into that exception.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With