Skip to content

Commit 0c45198

Browse files
authored
Avoid "early" access to SqlAuthenticationProviderManager.Instance (#2636)
1 parent 38ce399 commit 0c45198

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ internal sealed class SqlInternalConnectionTds : SqlInternalConnection, IDisposa
133133
internal readonly Func<SqlAuthenticationParameters, CancellationToken,Task<SqlAuthenticationToken>> _accessTokenCallback;
134134

135135
private readonly ActiveDirectoryAuthenticationTimeoutRetryHelper _activeDirectoryAuthTimeoutRetryHelper;
136-
private readonly SqlAuthenticationProviderManager _sqlAuthenticationProviderManager;
137136

138137
internal bool _cleanSQLDNSCaching = false;
139138
private bool _serverSupportsDNSCaching = false;
@@ -484,7 +483,6 @@ internal SqlInternalConnectionTds(
484483
_accessTokenCallback = accessTokenCallback;
485484

486485
_activeDirectoryAuthTimeoutRetryHelper = new ActiveDirectoryAuthenticationTimeoutRetryHelper();
487-
_sqlAuthenticationProviderManager = SqlAuthenticationProviderManager.Instance;
488486

489487
_identity = identity;
490488
Debug.Assert(newSecurePassword != null || newPassword != null, "cannot have both new secure change password and string based change password to be null");
@@ -2362,7 +2360,7 @@ internal SqlFedAuthToken GetFedAuthToken(SqlFedAuthInfo fedAuthInfo)
23622360
// Username to use in error messages.
23632361
string username = null;
23642362

2365-
var authProvider = _sqlAuthenticationProviderManager.GetProvider(ConnectionOptions.Authentication);
2363+
var authProvider = SqlAuthenticationProvider.GetProvider(ConnectionOptions.Authentication);
23662364
if (authProvider == null && _accessTokenCallback == null)
23672365
throw SQL.CannotFindAuthProvider(ConnectionOptions.Authentication.ToString());
23682366

0 commit comments

Comments
 (0)