You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
try{awaitdb.SaveChangesAsync(cancellationToken);}catch(OperationCanceledException){// my custom logic to handle cancels}
This setup, however, doesn't stop EF Core and it still logs OperationCanceledException to the console as a fail with the whole stack trace. I verified this by putting a break point at the first statement in the catch block. When break point is hit, the log entry is already there. I've found it rather inconvinient, because I now have to either live with an overflown by this exceptions log or disable all errors from Microsoft.EntityFrameworkCore.Update, so if something bad happens, it will not log the really valuable exception. It would be nice IMO if there is a flag, that indicates whether EF Core logs OperationCanceledExceptions (and maybe TaskCanceledExceptions) or not. It should probably be enabled by default, because these exceptions are usually used in a normal non-exceptional code pathes
The text was updated successfully, but these errors were encountered:
I have a code sample like this:
This setup, however, doesn't stop EF Core and it still logs
OperationCanceledException
to the console as afail
with the whole stack trace. I verified this by putting a break point at the first statement in thecatch
block. When break point is hit, the log entry is already there. I've found it rather inconvinient, because I now have to either live with an overflown by this exceptions log or disable all errors fromMicrosoft.EntityFrameworkCore.Update
, so if something bad happens, it will not log the really valuable exception. It would be nice IMO if there is a flag, that indicates whether EF Core logsOperationCanceledException
s (and maybeTaskCanceledException
s) or not. It should probably be enabled by default, because these exceptions are usually used in a normal non-exceptional code pathesThe text was updated successfully, but these errors were encountered: