ExecutionStrategy.ShouldRetryOn receives a null argument with concurrency exceptions #23019
Labels
area-save-changes
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
Milestone
The
ExecutionStrategy
base class automatically unwraps EF exceptions before passing them to theShouldRetryOn
method. The method which does the unwrapping,CallOnWrappedException
, seems to directly recurse on theInnerException
property of the parent exception without checking whether it is non-null.This is not an issue if all instances of
DbUpdateException
have a non-nullInnerException
, but it seems thatDbUpdateConcurrencyException
exceptions thrown by the SQL Server and Sqlite providers don't include one. This causes such exceptions to be undetectable from theShouldRetryOn
method, when deriving from theExecutionStrategy
base class.As this violates the
[NotNull]
attribute from the method's signature, this looks like a bug either with that method, or with theDbUpdateConcurrencyException
type which doesn't have anInnerException
.Code to Reproduce
Results
EF Core version: 3.1.9
Database provider: Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Sqlite
Target framework: .NET 4.6.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.3.7
The text was updated successfully, but these errors were encountered: