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
cts.CancelAfter(parameters.ConnectionTimeout *1000);// Convert to milliseconds
As the ConnectionTimeout is used to set the cancellation token's CancelAfter * 1000...
If ConnectionTimeout = 0 then 0 * 1000 = 0 - this causes the cancellation token to immediately expire, so all operations such as gather the tenant metadata fail with A task was canceled exception message (which is what led me down this rabbit hole).
If ConnectionTimeout = int.MaxValue (or any value greater than int.MaxValue / 1000) then int.MaxValue * 1000 throws as the result is larger than int.
Ideally this needs more defensive coding, eg:
When ConnectionTimeout == 0 we do not require a CancelAfter?
When ConnectionTimeout >= int.MaxValue / 1000 set the CancelAfter to int.MaxValue?
The text was updated successfully, but these errors were encountered:
Well that was fun to debug!
SqlClient/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs
Line 117 in 3f0c4b1
As the
ConnectionTimeout
is used to set the cancellation token'sCancelAfter
* 1000...ConnectionTimeout = 0
then0 * 1000 = 0
- this causes the cancellation token to immediately expire, so all operations such as gather the tenant metadata fail withA task was canceled
exception message (which is what led me down this rabbit hole).ConnectionTimeout = int.MaxValue
(or any value greater than int.MaxValue / 1000) thenint.MaxValue * 1000
throws as the result is larger than int.Ideally this needs more defensive coding, eg:
ConnectionTimeout == 0
we do not require aCancelAfter
?ConnectionTimeout >= int.MaxValue / 1000
set theCancelAfter
toint.MaxValue
?The text was updated successfully, but these errors were encountered: