Skip to content

Unkown exception after upgrading to .Net 5 #1171

Closed

Description

@kewinbrand

After upgrading to .NET 5 and consequently updating Microsoft.Data.SqlClient, we started to see strange errors related to the package. The call stack is very poor and I am not sure how to reproduce it.

Exception message:System.AggregateException
A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (Object reference not set to an instance of an object.)

Stack trace: System.NullReferenceException: Object reference not set to an instance of an object.
  ?, in void SNIPacket.ReadFromStreamAsync(Stream stream, SNIAsyncCallback callback)
  ?, in uint SNITCPHandle.ReceiveAsync(ref SNIPacket packet)
  ?, in uint SNIMarsConnection.ReceiveAsync(ref SNIPacket packet)
  ?, in void SNIMarsConnection.HandleReceiveComplete(SNIPacket packet, uint sniErrorCode)
  ?, in void Task.ExecuteWithThreadLocal(ref Task currentTaskSlot, Thread threadPoolThread)

Further technical details

Microsoft.Data.SqlClient version: 2.0.20168.4
.NET target: .NET 5.0.5
SQL Server version: SQL Server 2019
Operating system: Docker, Linux 5.4.17-2011.5.3.el8uek.x86_64 #2 SMP Wed Jul 29 22:09:11 PDT 2020

Activity

  1. ErikEJ commented on Jul 14, 2021

    @ErikEJ
    Contributor

    Have you tried version 3?

  2. JRahnama commented on Jul 14, 2021

    @JRahnama
    Contributor

    Hi @kewinbrand. If the application setup allows, can you try your application with MARS set to false and also as @ErikEJ mentioned try to update to the latest version please?
    If the issue persist can you provide a sample repro app as well?

  3. added
    Area\Managed SNI
    on Jul 14, 2021
  4. kewinbrand commented on Jul 16, 2021

    @kewinbrand
    Author

    I closed the issue unintentionally.

    Will update the packages and report in a few days. Just to show how sporadic the error is
    image

  5. cheenamalhotra commented on Jul 16, 2021

    @cheenamalhotra
    Member

    Hi @kewinbrand

    The driver version you're using is a non-LTS and is Out of Support. Also this issue had been fixed in v2.1 (ref #692).

    Please upgrade to either v2.1 or v3.0.

    If you continue to reproduce error, please provide a repro.

  6. kewinbrand commented on Jul 16, 2021

    @kewinbrand
    Author

    I don't reference the package manually. I see that Microsoft.EntityFrameworkCore.SqlServer uses [email protected]. Should I raise a issue to them?
    image

  7. ErikEJ commented on Jul 16, 2021

    @ErikEJ
    Contributor
  8. ErikEJ commented on Jul 16, 2021

    @ErikEJ
    Contributor

    Sadly EF Core 5 still depends on 2.0.1.

  9. cheenamalhotra commented on Jul 20, 2021

    @cheenamalhotra
    Member

    @kewinbrand do you have any further questions?
    I'm hoping referencing to a newer version resolved your issue?

  10. kewinbrand commented on Jul 26, 2021

    @kewinbrand
    Author

    @cheenamalhotra the problem has gone away after referencing the package
    i still don't believe ef core was released with such problem...

  11. ErikEJ commented on Jul 27, 2021

    @ErikEJ
    Contributor

    @kewinbrand far from all customers use the managed SNI layer, it is only applicable to non- Windows platforms

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

    Area\Managed SNI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions