During high load, our app randomly throw this error:
System.Data.SqlClient.SqlConnection.GetOpenTdsConnection
outerType
System.AggregateException
outerMessage
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.
innermostType
System.InvalidOperationException
innermostMessage
Invalid operation. The connection is closed
I looked into it and looks like this issue is fixed on Microsoft.Data.SQLClient
Our code comes from old world and still uses System.Data.SqlClient.Is there a way to know if same issue exists in System.Data.SqlClient and been fixed in a new version? Or we will have to use Microsoft.Data.SQLClient? (we tried Microsoft.Data.SqlClient before and there are behaviour differences)
If you are using tasks you can do the following try that I'm not sure that you will get all the information you want but you will get more information about unhandled exception
And you can use like below
Or you can use the
TaskScheduler.UnobservedTaskException
to get task exceptions where task exceptions are not observed.For more information see the below links
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
Looking for what caused the "A Task's exception(s) were not observed..."