John Reynolds John Reynolds - 1 year ago 107
C# Question

Finding the reason for DBUpdateException

When calling

DbContext.SaveChanges
, I get a DbUpdateException:

"An unhandled exception of type 'System.Data.Entity.Infrastructure.DbUpdateException' occurred in EntityFramework.dll. Additional information: An error occurred while updating the entries. See the inner exception for details."

Unfortunately, there is no inner exception (at least, not as far as I can see). Is there any way to see exactly why
SaveChanges
threw an exception? At the very least, it would be helpful to see what table SaveChanges tried to update with when the error occured.

Answer Source

When it seems that the real exception gets lost somewhere, your best bet is to break on every exception. Regardless of if it's catched or swallowed somewhere, in or out your reach, the debugger will break and allow you to see what's going on.

See this MSDN link for more info:

How to: Break When an Exception is Thrown

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download