Skip to content

Collect a .NET Core SQL Driver Trace

Malcolm Stewart edited this page Aug 22, 2022 · 21 revisions

Collect a .NET Core SQL Driver Trace

.NET Driver Trace vs. a BID Trace

BID Traces rely on the Event Tracing for Windows (ETW) infrastructure. This is what Windows drivers use. However, .NET Core apps are not targeted specifically at Windows and therefore use the .NET Event Tracing infrastructure. Fortunately, the .NET Core run-time provides the DOTNET-TRACE command to collect these traces on non-Windows operating systems.

Trace Event Name

  • The name of the trace event is Microsoft.Data.SqlClient.EventSource.
  • You can use this in PerfView on Windows to trace .NET Core apps on Windows.
  • This is also the trace name used in the examples below.

Prerequisites for Linux Tracing

Download the dotnet tool: Install .NET on Linux distributions - .NET

e.g. for Ubuntu using apt-get:

	sudo apt-get install -y dotnet-runtime-6.0

Installing dotnet-trace:

	dotnet tool install --global dotnet-trace

SSH is used for the command windows.
WinSCP is used to copy the files to the Windows machine.

Download PerfView: Releases · microsoft/perfview (github.com)

Clone this wiki locally