dotnet / SqlClient

Microsoft.Data.SqlClient provides database connectivity to SQL Server for .NET applications.
MIT License
817 stars 271 forks source link

Visual Studio Diagnostic Tools Events missing in Microsoft.Data.SqlClient #2634

Open Banner-Keith opened 4 days ago

Banner-Keith commented 4 days ago

We recently switched from System.Data.SqlClient to Microsoft.Data.SqlClient. One difference we've noticed that's been quite painful is that we no longer get events logged in the Visual Studio Diagnostic Tools window showing ADO.net queries.

Example: image

It doesn't appear that there's a way to get that experience out of the box. Is there some way we can at least dump this information in the debug log when we are debugging a running app?

I searched for related issues and found this in a different issue about tracing, but it wasn't addressed there since it was really a different issue. I thought it would be worth tracking down separately.

          I'm not sure what triggers items to appear in the Diagnostic tools internally, but liked the ability that we had with .Net to see the ADO requests in there. This ability seems to have been lost in Core. Assuming adding back in proper source calls would fix this issue, I'm fine with the change. The conversation was primarily around supporting App Insights and I wanted to make sure that the Diagnostic tools weren't forgotten about.

Originally posted by @jwooley in https://github.com/dotnet/SqlClient/issues/93#issuecomment-542770581