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
An exception of type FormatException is thrown intermittently when opening a connection.
The method overload TraceEvent<T0, T1>(string message, T0 args0, T1 args1, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "") takes precedence over the generic overload TraceEvent<T0, T1, T2>(string message, T0 args0, T1 args1, T2 args2) when the last argument is a string. An exception of type System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. is thrown, for example, from the method call in TryGetFedAuthTokenLocked.
Exception message: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Stack trace:
at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at Microsoft.Data.SqlClient.SqlClientEventSource.TraceEvent[T0,T1](String message, T0 args0, T1 args1, String memberName) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\src\\Microsoft\\Data\\SqlClient\\SqlClientEventSource.cs:line 363
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.TryGetFedAuthTokenLocked(SqlFedAuthInfo fedAuthInfo, DbConnectionPoolAuthenticationContext dbConnectionPoolAuthenticationContext, SqlFedAuthToken& fedAuthToken) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlInternalConnectionTds.cs:line 2712
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OnFedAuthInfo(SqlFedAuthInfo fedAuthInfo) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlInternalConnectionTds.cs:line 2636
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\TdsParser.cs:line 2667
at Microsoft.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\TdsParser.cs:line 2204
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlInternalConnectionTds.cs:line 1441
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover, Boolean isFirstTransparentAttempt, Boolean disableTnir) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlInternalConnectionTds.cs:line 2312
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlInternalConnectionTds.cs:line 1846
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlInternalConnectionTds.cs:line 1719
at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, ServerCertificateValidationCallback serverCallback, ClientCertificateRetrievalCallback clientCallback, DbConnectionPool pool, String accessToken, SqlClientOriginalNetworkAddressInfo originalNetworkAddressInfo, Boolean applyTransientFaultHandling) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlInternalConnectionTds.cs:line 537
at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlConnectionFactory.cs:line 143
at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\ProviderBase\\DbConnectionFactory.cs:line 163
at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\ProviderBase\\DbConnectionPool.cs:line 906
at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\ProviderBase\\DbConnectionPool.cs:line 2014
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\ProviderBase\\DbConnectionPool.cs:line 1419
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\ProviderBase\\DbConnectionPool.cs:line 1303
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\ProviderBase\\DbConnectionFactory.cs:line 354
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\ProviderBase\\DbConnectionInternal.cs:line 768
at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\ProviderBase\\DbConnectionClosed.cs:line 71
at Microsoft.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlConnection.cs:line 2117
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlConnection.cs:line 2105
at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides) in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlConnection.cs:line 1658
at Microsoft.Data.SqlClient.SqlConnection.Open() in H:\\tsaagent1\\_work\\18\\s\\src\\Microsoft.Data.SqlClient\\netfx\\src\\Microsoft\\Data\\SqlClient\\SqlConnection.cs:line 1626
To reproduce
Unfortunately, unable to reproduce the issue.
Expected behavior
I expect the connection to be opened without any exceptions.
Further technical details
Microsoft.Data.SqlClient version: 3.0.0
.NET target: Framework 4.7.1, 4.8, and .NET 5 (Probably all others as well)
SQL Server version: SQL Server 2017, Azure SQL.
Operating system: Windows Server, Windows 10
The text was updated successfully, but these errors were encountered:
@NadeemAfana the PR is approved and merged to the main branch. Our next release will happen around October 20th. Thanks for contribution. I close the issue as the PR is merged.
Describe the bug
An exception of type
FormatException
is thrown intermittently when opening a connection.The method overload
TraceEvent<T0, T1>(string message, T0 args0, T1 args1, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "")
takes precedence over the generic overloadTraceEvent<T0, T1, T2>(string message, T0 args0, T1 args1, T2 args2)
when the last argument is a string. An exception of typeSystem.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
is thrown, for example, from the method call inTryGetFedAuthTokenLocked
.To reproduce
Unfortunately, unable to reproduce the issue.
Expected behavior
I expect the connection to be opened without any exceptions.
Further technical details
Microsoft.Data.SqlClient version: 3.0.0
.NET target: Framework 4.7.1, 4.8, and .NET 5 (Probably all others as well)
SQL Server version: SQL Server 2017, Azure SQL.
Operating system: Windows Server, Windows 10
The text was updated successfully, but these errors were encountered: