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
{{ message }}
Repository navigation
The MARS TDS header contained errors connecting to Azure SQL Server #2886
I have an Microsoft .NET Framework 4.8 enterprise application running in Windows (10.0.17763.6189) and data stored on an Azure SQL database (Gen5, 12.0.2000.8).
Occasionally I get unrecoverable error stating: System.Data.SqlClient.SqlException (0x80131904): The incoming tabular data stream (TDS) protocol stream is incorrect. The MARS TDS header contained errors.
I'm using the System.Data.SqlClient 4.8.6
I have explicitly defined MultipleActiveResultSets=False in the connection string, but this still happens (not as often as without).
Possible duplicate of #85 which is closed even the issue still exists.
Stack trace:
System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__180_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
I have not managed to reproduce the issue with a single development environment.
changed the title [-]The MARS TDS header contained errors using ASP.NET Core and EF Core connecting to Azure SQL Server[/-][+]The MARS TDS header contained errors connecting to Azure SQL Server[/+]on Sep 25, 2024
Here's where it gets a little confusing. If your application targets .NET Framework and references that NuGet package, the package just forwards everything to System.Data.SqlClient (System.Data.dll) in .NET Framework.
I thought the MARS TDS header contained errors fixes were all backported to System.Data.SqlClient.
@cheenamalhotra - Do you remember if all the fixes were backported to SDS on netfx?
Change in #910 already exists in .NET Framework System.Data, and in a .NET Framework 4.8 application, the app context switch MakeReadAsyncBlocking is enabled by default, so my assumption is this should mitigate the problem?
@Thorium It's unlikely that System.Data.dll (.NET Framework) will be patched for this particular bug as the acceptance bar for backporting fixes to System.Data.dll is very high and only security bugs are backported since past few years now.
I would recommend migrating your application to use Microsoft.Data.SqlClient instead.
Are there any challenges you've seen when migrating to MDS? Please refer to porting-cheat-sheet for porting guidelines and let us know if you face any challenges or blockers when migrating.
Activity
[-]The MARS TDS header contained errors using ASP.NET Core and EF Core connecting to Azure SQL Server[/-][+]The MARS TDS header contained errors connecting to Azure SQL Server[/+]Thorium commentedon Sep 25, 2024
Sorry the original title, no entity framework here, just plain old simple SQL-connection.
ErikEJ commentedon Sep 25, 2024
This repository is for Microsoft.Data.SqlClient, System.Data.SqlClient is out of mainstream support and will be deprecated soon.
Thorium commentedon Sep 25, 2024
System.Data.SqlClient will not be deprecated in .NET Framework, only in .NET 6/8.
It's part of .NET Framework, and the support of .NET Framework continues, probably as long as big banks exists.
David-Engel commentedon Sep 25, 2024
System.Data.SqlClient 4.8.6 indicates you are referencing the System.Data.SqlClient NuGet package (https://www.nuget.org/packages/System.Data.SqlClient/4.8.6) since .NET Framework is currently only versioned up to 4.8.1. That package is not part of .NET Framework and is deprecated.
Here's where it gets a little confusing. If your application targets .NET Framework and references that NuGet package, the package just forwards everything to System.Data.SqlClient (System.Data.dll) in .NET Framework.
I thought the MARS TDS header contained errors fixes were all backported to System.Data.SqlClient.
@cheenamalhotra - Do you remember if all the fixes were backported to SDS on netfx?
cheenamalhotra commentedon Sep 26, 2024
@David-Engel
Are you talking about #922 or #910?
Change in #910 already exists in .NET Framework System.Data, and in a .NET Framework 4.8 application, the app context switch
MakeReadAsyncBlockingis enabled by default, so my assumption is this should mitigate the problem?I don't see we took back the #922 change.
cheenamalhotra commentedon Oct 1, 2024
@Thorium It's unlikely that System.Data.dll (.NET Framework) will be patched for this particular bug as the acceptance bar for backporting fixes to System.Data.dll is very high and only security bugs are backported since past few years now.
I would recommend migrating your application to use Microsoft.Data.SqlClient instead.
Are there any challenges you've seen when migrating to MDS? Please refer to porting-cheat-sheet for porting guidelines and let us know if you face any challenges or blockers when migrating.