efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Improve optimistic concurrency exception

Open tester346 opened this issue 6 years ago • 1 comments

Hello,

Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.

I believe that this particular exception message is too general.

Not only other people complained about it ( https://github.com/dotnet/efcore/issues/17747#issuecomment-530676088 ), but also I think it is kinda misleading (emphasis on concurrency).

Can we receive some more details like... about which entity (idk maybe its id or json dump or something) it is complaining?

I think it'd make migration between EFC versions way easier / less painful

Describe the solution you'd like

More detailed info about why this exception has been thrown.

tester346 avatar Aug 27 '20 10:08 tester346

Putting on the backlog to consider adding some identifying information in the message when sensitive data logging is enabled. This will primarily be useful for debugging cases where this is not thrown as the result of optimistic concurrency, but rather as a consequence of things like triggers in the database.

ajcvickers avatar Aug 28 '20 19:08 ajcvickers