Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unkown exception after upgrading to .Net 5 #1171

Closed
kewinbrand opened this issue Jul 14, 2021 · 10 comments
Closed

Unkown exception after upgrading to .Net 5 #1171

kewinbrand opened this issue Jul 14, 2021 · 10 comments
Labels
Area\Managed SNI Issues that are targeted to the Managed SNI codebase.

Comments

@kewinbrand
Copy link

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

@ErikEJ
Copy link
Contributor

ErikEJ commented Jul 14, 2021

Have you tried version 3?

@JRahnama
Copy link
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?

@JRahnama JRahnama added the Area\Managed SNI Issues that are targeted to the Managed SNI codebase. label Jul 14, 2021
@kewinbrand
Copy link
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

@kewinbrand kewinbrand reopened this Jul 16, 2021
@cheenamalhotra
Copy link
Member

cheenamalhotra commented Jul 16, 2021

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.

@kewinbrand
Copy link
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

@ErikEJ
Copy link
Contributor

ErikEJ commented Jul 16, 2021

Just add an explicit packagereference to the newer version

https://erikej.github.io/efcore/sqlclient/2020/03/22/update_mds.html

@ErikEJ
Copy link
Contributor

ErikEJ commented Jul 16, 2021

Sadly EF Core 5 still depends on 2.0.1.

@cheenamalhotra
Copy link
Member

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

@kewinbrand
Copy link
Author

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

@ErikEJ
Copy link
Contributor

ErikEJ commented Jul 27, 2021

@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
Labels
Area\Managed SNI Issues that are targeted to the Managed SNI codebase.
Projects
None yet
Development

No branches or pull requests

4 participants