From 464e94f49fa034300d67e95d4cf6af1528ea5d00 Mon Sep 17 00:00:00 2001 From: Edward Neal <55035479+edwardneal@users.noreply.github.com> Date: Mon, 23 Jun 2025 07:33:48 +0100 Subject: [PATCH 1/3] Move GetSniErrorDetails to TdsParserStateObject --- .../Data/SqlClient/TdsParser.Unix.cs | 16 ------- .../Data/SqlClient/TdsParser.Windows.cs | 32 -------------- .../src/Microsoft/Data/SqlClient/TdsParser.cs | 42 +++++++++---------- .../SqlClient/TdsParserStateObjectManaged.cs | 7 ++++ .../SqlClient/TdsParserStateObjectNative.cs | 7 ++++ .../src/Microsoft/Data/SqlClient/TdsParser.cs | 27 ++++++------ .../SqlClient/TdsParserStateObjectNative.cs | 7 ++++ .../Data/SqlClient/TdsParserStateObject.cs | 34 +++++++++++++++ 8 files changed, 89 insertions(+), 83 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.Unix.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.Unix.cs index d71332a25a..c993df824c 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.Unix.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.Unix.cs @@ -22,21 +22,5 @@ private void WaitForSSLHandShakeToComplete(ref uint error, ref int protocolVersi { // No - Op } - - private SNIErrorDetails GetSniErrorDetails() - { - SNIErrorDetails details; - SniError sniError = SniProxy.Instance.GetLastError(); - details.sniErrorNumber = sniError.sniError; - details.errorMessage = sniError.errorMessage; - details.nativeError = sniError.nativeError; - details.provider = (int)sniError.provider; - details.lineNumber = sniError.lineNumber; - details.function = sniError.function; - details.exception = sniError.exception; - - return details; - } - } } diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.Windows.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.Windows.cs index 25bc6f87c5..2c924b3b79 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.Windows.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.Windows.cs @@ -4,9 +4,6 @@ using System; using System.Diagnostics; -using Interop.Windows.Sni; -using Microsoft.Data.SqlClient.ManagedSni; -using SniError = Microsoft.Data.SqlClient.ManagedSni.SniError; namespace Microsoft.Data.SqlClient { @@ -62,34 +59,5 @@ private void WaitForSSLHandShakeToComplete(ref uint error, ref int protocolVersi ThrowExceptionAndWarning(_physicalStateObj); } } - - private SNIErrorDetails GetSniErrorDetails() - { - SNIErrorDetails details = new SNIErrorDetails(); - - if (TdsParserStateObjectFactory.UseManagedSNI) - { - SniError sniError = SniProxy.Instance.GetLastError(); - details.sniErrorNumber = sniError.sniError; - details.errorMessage = sniError.errorMessage; - details.nativeError = sniError.nativeError; - details.provider = (int)sniError.provider; - details.lineNumber = sniError.lineNumber; - details.function = sniError.function; - details.exception = sniError.exception; - } - else - { - SniNativeWrapper.SniGetLastError(out Interop.Windows.Sni.SniError sniError); - details.sniErrorNumber = sniError.sniError; - details.errorMessage = sniError.errorMessage; - details.nativeError = sniError.nativeError; - details.provider = (int)sniError.provider; - details.lineNumber = sniError.lineNumber; - details.function = sniError.function; - } - return details; - } - } // tdsparser }//namespace diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs index 5320d1e51f..fe54073969 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs @@ -1450,12 +1450,12 @@ internal SqlError ProcessSNIError(TdsParserStateObject stateObj) SqlClientEventSource.Log.TryTraceEvent(" SNIContext must not be None = {0}, _fMARS = {1}, TDS Parser State = {2}", stateObj.DebugOnlyCopyOfSniContext, _fMARS, _state); #endif - SNIErrorDetails details = GetSniErrorDetails(); + TdsParserStateObject.SniErrorDetails details = stateObj.GetErrorDetails(); - if (details.sniErrorNumber != 0) + if (details.SniErrorNumber != 0) { // handle special SNI error codes that are converted into exception which is not a SqlException. - switch (details.sniErrorNumber) + switch (details.SniErrorNumber) { case SniErrors.MultiSubnetFailoverWithMoreThan64IPs: // Connecting with the MultiSubnetFailover connection option to a SQL Server instance configured with more than 64 IP addresses is not supported. @@ -1476,8 +1476,8 @@ internal SqlError ProcessSNIError(TdsParserStateObject stateObj) } // PInvoke code automatically sets the length of the string for us // So no need to look for \0 - string errorMessage = details.errorMessage; - SqlClientEventSource.Log.TryAdvancedTraceEvent("< sc.TdsParser.ProcessSNIError |ERR|ADV > Error message Detail: {0}", details.errorMessage); + string errorMessage = details.ErrorMessage; + SqlClientEventSource.Log.TryAdvancedTraceEvent("< sc.TdsParser.ProcessSNIError |ERR|ADV > Error message Detail: {0}", details.ErrorMessage); /* Format SNI errors and add Context Information * @@ -1494,25 +1494,25 @@ internal SqlError ProcessSNIError(TdsParserStateObject stateObj) if (TdsParserStateObjectFactory.UseManagedSNI) { - Debug.Assert(!string.IsNullOrEmpty(details.errorMessage) || details.sniErrorNumber != 0, "Empty error message received from SNI"); - SqlClientEventSource.Log.TryAdvancedTraceEvent(" Empty error message received from SNI. Error Message = {0}, SNI Error Number ={1}", details.errorMessage, details.sniErrorNumber); + Debug.Assert(!string.IsNullOrEmpty(details.ErrorMessage) || details.SniErrorNumber != 0, "Empty error message received from SNI"); + SqlClientEventSource.Log.TryAdvancedTraceEvent(" Empty error message received from SNI. Error Message = {0}, SNI Error Number ={1}", details.ErrorMessage, details.SniErrorNumber); } else { - Debug.Assert(!string.IsNullOrEmpty(details.errorMessage), "Empty error message received from SNI"); - SqlClientEventSource.Log.TryAdvancedTraceEvent(" Empty error message received from SNI. Error Message = {0}", details.errorMessage); + Debug.Assert(!string.IsNullOrEmpty(details.ErrorMessage), "Empty error message received from SNI"); + SqlClientEventSource.Log.TryAdvancedTraceEvent(" Empty error message received from SNI. Error Message = {0}", details.ErrorMessage); } string sqlContextInfo = StringsHelper.GetResourceString(stateObj.SniContext.ToString()); - string providerRid = string.Format("SNI_PN{0}", details.provider); + string providerRid = string.Format("SNI_PN{0}", details.Provider); string providerName = StringsHelper.GetResourceString(providerRid); Debug.Assert(!string.IsNullOrEmpty(providerName), $"invalid providerResourceId '{providerRid}'"); - uint win32ErrorCode = details.nativeError; + uint win32ErrorCode = details.NativeError; SqlClientEventSource.Log.TryAdvancedTraceEvent(" SNI Native Error Code = {0}", win32ErrorCode); - if (details.sniErrorNumber == 0) + if (details.SniErrorNumber == 0) { - // Provider error. The message from provider is preceeded with non-localizable info from SNI + // Provider error. The message from provider is preceded with non-localizable info from SNI // strip provider info from SNI // int iColon = errorMessage.IndexOf(':'); @@ -1544,7 +1544,7 @@ internal SqlError ProcessSNIError(TdsParserStateObject stateObj) if (TdsParserStateObjectFactory.UseManagedSNI) { // SNI error. Append additional error message info if available and hasn't been included. - string sniLookupMessage = SQL.GetSNIErrorMessage(details.sniErrorNumber); + string sniLookupMessage = SQL.GetSNIErrorMessage(details.SniErrorNumber); errorMessage = (string.IsNullOrEmpty(errorMessage) || errorMessage.Contains(sniLookupMessage)) ? sniLookupMessage : (sniLookupMessage + ": " + errorMessage); @@ -1552,25 +1552,25 @@ internal SqlError ProcessSNIError(TdsParserStateObject stateObj) else { // SNI error. Replace the entire message. - errorMessage = SQL.GetSNIErrorMessage(details.sniErrorNumber); + errorMessage = SQL.GetSNIErrorMessage(details.SniErrorNumber); // If its a LocalDB error, then nativeError actually contains a LocalDB-specific error code, not a win32 error code - if (details.sniErrorNumber == SniErrors.LocalDBErrorCode) + if (details.SniErrorNumber == SniErrors.LocalDBErrorCode) { - errorMessage += LocalDbApi.GetLocalDbMessage((int)details.nativeError); + errorMessage += LocalDbApi.GetLocalDbMessage((int)details.NativeError); win32ErrorCode = 0; } SqlClientEventSource.Log.TryAdvancedTraceEvent(" Extracting the latest exception from native SNI. errorMessage: {0}", errorMessage); } } errorMessage = string.Format("{0} (provider: {1}, error: {2} - {3})", - sqlContextInfo, providerName, (int)details.sniErrorNumber, errorMessage); + sqlContextInfo, providerName, (int)details.SniErrorNumber, errorMessage); SqlClientEventSource.Log.TryAdvancedTraceErrorEvent(" SNI Error Message. Native Error = {0}, Line Number ={1}, Function ={2}, Exception ={3}, Server = {4}", - (int)details.nativeError, (int)details.lineNumber, details.function, details.exception, _server); + (int)details.NativeError, (int)details.LineNumber, details.Function, details.Exception, _server); - return new SqlError(infoNumber: (int)details.nativeError, errorState: 0x00, TdsEnums.FATAL_ERROR_CLASS, _server, - errorMessage, details.function, (int)details.lineNumber, win32ErrorCode: details.nativeError, details.exception); + return new SqlError(infoNumber: (int)details.NativeError, errorState: 0x00, TdsEnums.FATAL_ERROR_CLASS, _server, + errorMessage, details.Function, (int)details.LineNumber, win32ErrorCode: details.NativeError, details.Exception); } } diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs index a403f8b556..efe6c3fc5b 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs @@ -392,6 +392,13 @@ internal override uint WaitForSSLHandShakeToComplete(out int protocolVersion) return 0; } + internal override SniErrorDetails GetErrorDetails() + { + SniError sniError = SniProxy.Instance.GetLastError(); + + return new SniErrorDetails(sniError.errorMessage, sniError.nativeError, sniError.sniError, (int)sniError.provider, sniError.lineNumber, sniError.function, sniError.exception); + } + private SniHandle GetSessionSNIHandleHandleOrThrow() { SniHandle? sessionHandle = _sessionHandle; diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs index 10e9d96eca..9622120901 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs @@ -441,6 +441,13 @@ internal override uint WaitForSSLHandShakeToComplete(out int protocolVersion) return returnValue; } + internal override SniErrorDetails GetErrorDetails() + { + SniNativeWrapper.SniGetLastError(out SniError sniError); + + return new SniErrorDetails(sniError.errorMessage, sniError.nativeError, sniError.sniError, (int)sniError.provider, sniError.lineNumber, sniError.function); + } + internal override void DisposePacketCache() { lock (_writePacketLockObject) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs index d602928be8..8930f61cca 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs @@ -1542,14 +1542,13 @@ internal SqlError ProcessSNIError(TdsParserStateObject stateObj) // There is an exception here for MARS as its possible that another thread has closed the connection just as we see an error Debug.Assert(SniContext.Undefined != stateObj.DebugOnlyCopyOfSniContext || ((_fMARS) && ((_state == TdsParserState.Closed) || (_state == TdsParserState.Broken))), "SniContext must not be None"); #endif - SniError details = new SniError(); - SniNativeWrapper.SniGetLastError(out details); + TdsParserStateObject.SniErrorDetails details = stateObj.GetErrorDetails(); - if (details.sniError != 0) + if (details.SniErrorNumber != 0) { // handle special SNI error codes that are converted into exception which is not a SqlException. - switch (details.sniError) + switch (details.SniErrorNumber) { case SniErrors.MultiSubnetFailoverWithMoreThan64IPs: // Connecting with the MultiSubnetFailover connection option to a SQL Server instance configured with more than 64 IP addresses is not supported. @@ -1569,7 +1568,7 @@ internal SqlError ProcessSNIError(TdsParserStateObject stateObj) // error.errorMessage is null terminated with garbage beyond that, since fixed length string errorMessage; - errorMessage = string.IsNullOrEmpty(details.errorMessage) ? string.Empty : details.errorMessage; + errorMessage = string.IsNullOrEmpty(details.ErrorMessage) ? string.Empty : details.ErrorMessage; /* Format SNI errors and add Context Information * * General syntax is: @@ -1586,12 +1585,12 @@ internal SqlError ProcessSNIError(TdsParserStateObject stateObj) Debug.Assert(!string.IsNullOrEmpty(errorMessage), "Empty error message received from SNI"); string sqlContextInfo = StringsHelper.GetString(Enum.GetName(typeof(SniContext), stateObj.SniContext)); - string providerRid = string.Format("SNI_PN{0}", (int)details.provider); + string providerRid = string.Format("SNI_PN{0}", (int)details.Provider); string providerName = StringsHelper.GetString(providerRid); Debug.Assert(!string.IsNullOrEmpty(providerName), $"invalid providerResourceId '{providerRid}'"); - uint win32ErrorCode = details.nativeError; + uint win32ErrorCode = details.NativeError; - if (details.sniError == 0) + if (details.SniErrorNumber == 0) { // Provider error. The message from provider is preceeded with non-localizable info from SNI // strip provider info from SNI @@ -1622,20 +1621,20 @@ internal SqlError ProcessSNIError(TdsParserStateObject stateObj) else { // SNI error. Replace the entire message. - errorMessage = SQL.GetSNIErrorMessage(details.sniError); + errorMessage = SQL.GetSNIErrorMessage(details.SniErrorNumber); // If its a LocalDB error, then nativeError actually contains a LocalDB-specific error code, not a win32 error code - if (details.sniError == SniErrors.LocalDBErrorCode) + if (details.SniErrorNumber == SniErrors.LocalDBErrorCode) { - errorMessage += LocalDbApi.GetLocalDbMessage((int)details.nativeError); + errorMessage += LocalDbApi.GetLocalDbMessage((int)details.NativeError); win32ErrorCode = 0; } } errorMessage = string.Format("{0} (provider: {1}, error: {2} - {3})", - sqlContextInfo, providerName, (int)details.sniError, errorMessage); + sqlContextInfo, providerName, (int)details.SniErrorNumber, errorMessage); - return new SqlError((int)details.nativeError, 0x00, TdsEnums.FATAL_ERROR_CLASS, - _server, errorMessage, details.function, (int)details.lineNumber, win32ErrorCode); + return new SqlError((int)details.NativeError, 0x00, TdsEnums.FATAL_ERROR_CLASS, + _server, errorMessage, details.Function, (int)details.LineNumber, win32ErrorCode); } internal void CheckResetConnection(TdsParserStateObject stateObj) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs index 2ad67cf2f4..807474d98b 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs @@ -175,6 +175,13 @@ internal override uint EnableMars(ref uint info) internal override uint SetConnectionBufferSize(ref uint unsignedPacketSize) => SniNativeWrapper.SniSetInfo(Handle, QueryType.SNI_QUERY_CONN_BUFSIZE, ref unsignedPacketSize); + internal override SniErrorDetails GetErrorDetails() + { + SniNativeWrapper.SniGetLastError(out SniError sniError); + + return new SniErrorDetails(sniError.errorMessage, sniError.nativeError, sniError.sniError, (int)sniError.provider, sniError.lineNumber, sniError.function); + } + internal override void DisposePacketCache() { lock (_writePacketLockObject) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs index ea3e4a9ce6..582a2f6890 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs @@ -52,6 +52,38 @@ internal enum SnapshottedStateFlags : byte AttentionReceived = 1 << 5 // NOTE: Received is not volatile as it is only ever accessed\modified by TryRun its callees (i.e. single threaded access) } + internal readonly struct SniErrorDetails + { + public readonly string ErrorMessage; + public readonly uint NativeError; + public readonly uint SniErrorNumber; + public readonly int Provider; + public readonly uint LineNumber; + public readonly string Function; + public readonly Exception Exception; + + internal SniErrorDetails(string errorMessage, uint nativeError, uint sniErrorNumber, int provider, uint lineNumber, string function, Exception exception) + { + ErrorMessage = errorMessage; + NativeError = nativeError; + SniErrorNumber = sniErrorNumber; + Provider = provider; + LineNumber = lineNumber; + Function = function; + Exception = exception; + } + + internal SniErrorDetails(string errorMessage, uint nativeError, uint sniErrorNumber, int provider, uint lineNumber, string function) + { + ErrorMessage = errorMessage; + NativeError = nativeError; + SniErrorNumber = sniErrorNumber; + Provider = provider; + LineNumber = lineNumber; + Function = function; + } + } + private sealed class TimeoutState { public const int Stopped = 0; @@ -521,6 +553,8 @@ internal long TimeoutTime internal abstract void DisposePacketCache(); + internal abstract SniErrorDetails GetErrorDetails(); + internal int GetTimeoutRemaining() { int remaining; From d4cf31794af35cc1f52a9e3203f4fe6873d36f0a Mon Sep 17 00:00:00 2001 From: Edward Neal <55035479+edwardneal@users.noreply.github.com> Date: Wed, 25 Jun 2025 21:40:30 +0100 Subject: [PATCH 2/3] Use optional parameter in SniErrorDetails constructor --- .../Microsoft/Data/SqlClient/TdsParserStateObject.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs index 582a2f6890..fb748d5812 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs @@ -62,7 +62,7 @@ internal readonly struct SniErrorDetails public readonly string Function; public readonly Exception Exception; - internal SniErrorDetails(string errorMessage, uint nativeError, uint sniErrorNumber, int provider, uint lineNumber, string function, Exception exception) + internal SniErrorDetails(string errorMessage, uint nativeError, uint sniErrorNumber, int provider, uint lineNumber, string function, Exception exception = null) { ErrorMessage = errorMessage; NativeError = nativeError; @@ -72,16 +72,6 @@ internal SniErrorDetails(string errorMessage, uint nativeError, uint sniErrorNum Function = function; Exception = exception; } - - internal SniErrorDetails(string errorMessage, uint nativeError, uint sniErrorNumber, int provider, uint lineNumber, string function) - { - ErrorMessage = errorMessage; - NativeError = nativeError; - SniErrorNumber = sniErrorNumber; - Provider = provider; - LineNumber = lineNumber; - Function = function; - } } private sealed class TimeoutState From d643b06ec7748ff64e789623a5118e0c3c275775 Mon Sep 17 00:00:00 2001 From: Edward Neal <55035479+edwardneal@users.noreply.github.com> Date: Thu, 3 Jul 2025 22:05:52 +0100 Subject: [PATCH 3/3] Format line breaks --- .../Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs | 4 +++- .../Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs index efe6c3fc5b..16be2e763c 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs @@ -396,7 +396,9 @@ internal override SniErrorDetails GetErrorDetails() { SniError sniError = SniProxy.Instance.GetLastError(); - return new SniErrorDetails(sniError.errorMessage, sniError.nativeError, sniError.sniError, (int)sniError.provider, sniError.lineNumber, sniError.function, sniError.exception); + return new SniErrorDetails(sniError.errorMessage, sniError.nativeError, sniError.sniError, + (int)sniError.provider, sniError.lineNumber, sniError.function, + sniError.exception); } private SniHandle GetSessionSNIHandleHandleOrThrow() diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs index 9622120901..895c46c7bf 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs @@ -445,7 +445,8 @@ internal override SniErrorDetails GetErrorDetails() { SniNativeWrapper.SniGetLastError(out SniError sniError); - return new SniErrorDetails(sniError.errorMessage, sniError.nativeError, sniError.sniError, (int)sniError.provider, sniError.lineNumber, sniError.function); + return new SniErrorDetails(sniError.errorMessage, sniError.nativeError, sniError.sniError, + (int)sniError.provider, sniError.lineNumber, sniError.function); } internal override void DisposePacketCache()