Most likely your SqlException
has _doNotReconnect
= true.
Here you can see how the provider checks if an exception is transient: https://github.com/dotnet/SqlClient/blob/9450fde6e79c0197dbf8189e578078549ad5fee0/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryFactory.cs#L113
if (retriableConditions != null && e is SqlException ex && !ex._doNotReconnect)
To control it, you can create your custom provider and implement your own TransientErrorsCondition()
as you want. See a sample at https://learn.microsoft.com/en-us/sql/connect/ado-net/configurable-retry-logic-core-apis-sqlclient