Skip to content

Unkown exception after upgrading to .Net 5 #1171

@kewinbrand

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area\Managed SNIIssues that are targeted to the Managed SNI codebase.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions