dotnet-diag

Diagnose performance issues and debug CLR activation in .NET desktop applications.

Updated Aug 24, 2026
One-click install
npx skills add https://github.com/aggutierrez98/TP-TD --skill dotnet-diag-aggutierrez98
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-diag
Source: https://github.com/aggutierrez98/TP-TD/tree/main/.agents/skills/dotnet-diag
Command: npx skills add https://github.com/aggutierrez98/TP-TD --skill dotnet-diag-aggutierrez98

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Investigating slow UI, high memory usage, hangs, and CLR startup errors in .NET desktop apps is time-consuming without a structured diagnostic workflow. This Skill guides you through static performance analysis, trace and dump collection, microbenchmarking, and CLR activation debugging. ## Core Features & Use Cases - Static Performance Scan: Detect roughly 50 categories of C# performance anti-patterns (async/await, memory, strings, LINQ, regex, collections, I/O) without running the app. - Trace and Dump Collection: Capture CPU traces and memory dumps from running processes, with .NET Framework alternatives like PerfView, ProcDump, and WinDbg/SOS. - Microbenchmarking: Write BenchmarkDotNet benchmarks to measure algorithms precisely before optimizing. - Use Case: A WinForms screen freezes intermittently. Run the static anti-pattern scan on the suspect code, then capture a memory dump during the hang and analyze it with WinDbg/SOS to find the blocking call. ## Quick Start Ask the AI to scan your C# code for performance anti-patterns and recommend whether to collect a trace, a dump, or a benchmark next.

Frequently Asked Questions about dotnet-diag

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find performance anti-patterns in C# code?▼

Run a static performance scan that checks roughly 50 categories of C# anti-patterns, including async/await misuse, excessive allocations, string concatenation, LINQ inefficiencies, regex, collections, and I/O. It works on source code without running the application.

How to collect a CPU trace on .NET Framework without dotnet-trace?▼

dotnet-trace requires the modern .NET CLI, which does not target .NET Framework apps. Use PerfView as the equivalent tool to capture CPU samples and runtime events from a running .NET Framework 4.7.2 process.

Can I capture a memory dump of a hung WinForms application?▼

Yes. On .NET Framework, use ProcDump or Task Manager to capture a memory dump while the process is hung, then analyze it with WinDbg plus the SOS extension or dotMemory to find blocked threads and leaks.

When should I write a BenchmarkDotNet benchmark before optimizing?▼

Write a benchmark before optimizing any critical algorithm so you have a precise baseline measurement. This prevents wasted effort on changes that do not measurably improve performance and verifies the optimization afterward.

Why does my .NET app fail at startup with an HRESULT error?▼

Startup HRESULT errors usually indicate CLR activation problems such as runtime version mismatches or assembly binding failures. Diagnose them with the CLR activation debugging workflow, which inspects binding logs and runtime configuration.