Skip to content

The MARS TDS header contained errors connecting to Azure SQL Server #2886

Closed as not planned

Description

@Thorium

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.

Activity

  1. 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
  2. Thorium commented on Sep 25, 2024

    @Thorium
    Author

    Sorry the original title, no entity framework here, just plain old simple SQL-connection.

  3. ErikEJ commented on Sep 25, 2024

    @ErikEJ
    Contributor

    This repository is for Microsoft.Data.SqlClient, System.Data.SqlClient is out of mainstream support and will be deprecated soon.

  4. Thorium commented on Sep 25, 2024

    @Thorium
    Author

    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.

  5. David-Engel commented on Sep 25, 2024

    @David-Engel
    Contributor

    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?

  6. cheenamalhotra commented on Sep 26, 2024

    @cheenamalhotra
    Member

    @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 MakeReadAsyncBlocking is enabled by default, so my assumption is this should mitigate the problem?

    I don't see we took back the #922 change.

  7. cheenamalhotra commented on Oct 1, 2024

    @cheenamalhotra
    Member

    @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.

  8. added
    System.Data.SqlClient 👴
    and removed on Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    System.Data.SqlClient 👴

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions