dotnet / SqlClient

Microsoft.Data.SqlClient provides database connectivity to SQL Server for .NET applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Banner-Keith opened this issue · comments

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 #93 (comment)

This issue is a duplicate of issue #93.

However, you may want to consider SqlClient's EventSource implementation.

https://learn.microsoft.com/en-us/sql/connect/ado-net/enable-eventsource-tracing?view=sql-server-ver16

@arellegue I don't really think this is a duplicate. They are the same root cause but #93 never addressed the Visual Studio side of this issue. Only really App Insights. For a developer debugging in real-time the events showing up in the Diagnostic Tools was a huge time saver.

I will look at Event Source.

@Banner-Keith I have reached out to the Visual Studio team internally to get some guidance on this issue and its potential fix. I will update this thread when I have an answer for you.

@JRahnama thank you for that. I really appreciate it.

@Banner-Keith this issue is external to SqlClient. Can you open a ticket at Developer Community(visualstudio.com) and follow there? Seems like the action needs to be taken from their side to include M.D.SqlClient in their product.

Closing the issue as it is external to SqlClient. Feel free to comment here or open a new issue.