.NET › Diagnostics & Performance
What tools does .NET provide for basic application diagnostics, and what is dotnet-trace used for?
BeginnerAnswer
The .NET SDK includes global diagnostic tools installable via `dotnet tool install -g`: dotnet-trace collects CPU and runtime event traces for performance analysis, dotnet-counters displays live performance counters (GC stats, request rate, CPU usage), dotnet-dump captures and analyzes memory dumps, and dotnet-gcdump captures GC heap snapshots -- all usable against a running process without needing to restart or attach a debugger.
dotnet tool install -g dotnet-trace
dotnet-trace collect --process-id 1234 --duration 00:00:30
# Produces a .nettrace file, viewable in PerfView or Visual StudioReal-world example An on-call engineer diagnosing a production CPU spike attaches dotnet-trace to the running process for 30 seconds without any downtime, then analyzes the resulting trace file to identify the specific method consuming excessive CPU.