dotnet-debugging
Overview
Windows and Linux/macOS debugging using WinDbg MCP tools (Windows), dotnet-dump, and lldb with SOS (Linux/macOS). Applicable to any application -- native, managed (.NET/CLR), or mixed-mode. Includes container diagnostic patterns for Docker and Kubernetes. Guides investigation of crash dumps, application hangs, high CPU, and memory pressure through structured command packs and report templates.
Platforms: Windows (WinDbg MCP, cdb), Linux/macOS (dotnet-dump, lldb with SOS, createdump, dotnet-monitor).
Routing Table
| Topic |
Keywords |
Description |
Companion File |
| MCP setup |
MCP server, WinDbg, configuration |
MCP server configuration |
references/mcp-setup.md |
| MCP access |
MCP access, tool IDs, dispatch |
MCP access patterns |
references/access-mcp.md |
| Common patterns |
debug patterns, SOS, CLR |
Common debugging patterns |
references/common-patterns.md |
| Dump workflow |
dump file, .dmp, crash dump |
Dump file analysis workflow |
references/dump-workflow.md |
| Live attach |
live process, cdb, attach |
Live process attach guide |
references/live-attach.md |
| Symbols |
symbol server, .symfix, PDB |
Symbol configuration |
references/symbols.md |
| Sanity check |
verify, environment, baseline |
Sanity check procedures |
references/sanity-check.md |
| Scenario packs |
command pack, triage, workflow |
Scenario command packs |
references/scenario-command-packs.md |
| Capture playbooks |
capture, procdump, triggers |
Capture playbooks |
references/capture-playbooks.md |
| Report template |
diagnostic report, evidence |
Diagnostic report template |
references/report-template.md |
| Crash triage |
crash, exception, access violation |
Crash triage |
references/task-crash.md |
| Hang triage |
hang, deadlock, freeze |
Hang triage |
references/task-hang.md |
| High-CPU triage |
high CPU, runaway thread, spin |
High-CPU triage |
references/task-high-cpu.md |
| Memory triage |
memory leak, heap, LOH |
Memory leak triage |
references/task-memory.md |
| Kernel debugging |
kernel, BSOD, bugcheck |
Kernel debugging |
references/task-kernel.md |
| Unknown triage |
unknown issue, general triage |
Unknown issue triage |
references/task-unknown.md |
| Linux debugging |
dotnet-dump, lldb, createdump, container |
Linux/macOS debugging, dotnet-dump, lldb SOS, containers |
references/linux-debugging.md |
Scope
- Crash dump analysis (.dmp files) on Windows, Linux, and macOS
- Live process attach (cdb on Windows, lldb on Linux/macOS)
- Hang and deadlock diagnosis (thread analysis, lock detection, wait chains)
- High CPU triage (runaway thread identification)
- Memory pressure and leak investigation (managed heap, native heap)
- Kernel dump triage (BSOD / bugcheck analysis, Windows)
- Container diagnostics (dotnet-dump in Docker/Kubernetes, sidecar patterns)
- Production diagnostics (dotnet-monitor REST API, trigger-based collection)
- SOS commands across all platforms (WinDbg, dotnet-dump, lldb)
- Structured diagnostic reports with stack evidence
Boundary with dotnet-tooling
Both skills use overlapping tools (dotnet-dump, dotnet-counters, dotnet-trace) but for different purposes:
| Scenario |
Use this skill (debugging) |
Use dotnet-tooling |
| Investigating a crash dump (.dmp) |
Yes |
No |
| "Why did my app crash/hang/OOM?" |
Yes |
No |
| Attaching a debugger to a live process |
Yes |
No |
| "How do I profile my app's performance?" |
No |
Yes (profiling) |
| "How do I reduce GC pressure?" |
No |
Yes (gc-memory) |
| Collecting a dump for later analysis |
Yes |
No |
| Running dotnet-counters to monitor metrics |
No |
Yes (profiling) |
| Analyzing a dump with dotnet-dump |
Yes |
No |
| Decompiling an assembly to understand behavior |
No |
Yes (ilspy-decompile) |
Rule of thumb: if something is broken (crash, hang, deadlock, OOM), route here. If something is slow or needs optimization, route to dotnet-tooling.
Out of scope
- Performance profiling (dotnet-counters, dotnet-trace for optimization) ->
dotnet-tooling
- GC tuning and managed memory optimization ->
dotnet-tooling
- Assembly decompilation (ILSpy) ->
dotnet-tooling
- Performance benchmarking and regression detection ->
dotnet-testing
- Application-level logging and observability ->
dotnet-devops
- Unit/integration test debugging ->
dotnet-testing
MCP Tool Contract
These tool IDs are the WinDbg MCP server's exported names (single-underscore mcp_...), not the mcp__... dispatch prefix used by some hosts.
| Operation |
Purpose |
mcp_mcp-windbg_open_windbg_remote |
Attach to a live debug server |
mcp_mcp-windbg_open_windbg_dump |
Open a saved dump file |
mcp_mcp-windbg_run_windbg_cmd |
Execute debugger commands |
mcp_mcp-windbg_close_windbg_remote |
Detach from live session |
mcp_mcp-windbg_close_windbg_dump |
Close dump session |
Diagnostic Workflow
Preflight: Symbols
Before any analysis, configure symbols to get meaningful stacks:
- Set Microsoft symbol server:
.symfix (sets srv* to Microsoft public symbols)
- Add application symbols:
.sympath+ C:\path\to\your\pdbs
- Reload modules:
.reload /f
- Verify:
lm (list modules -- check for "deferred" vs "loaded" status)
Without correct symbols, stacks show raw addresses instead of function names.
Crash Dump Analysis
- Open dump:
mcp_mcp-windbg_open_windbg_dump with dump file path
- Load SOS for managed code:
.loadby sos clr (Framework) or .loadby sos coreclr (.NET Core)
- Get exception context:
!pe (print exception), !analyze -v (automatic analysis)
- Inspect threads:
~*e !clrstack (all managed stacks), !threads (thread list)
- Check managed heap:
!dumpheap -stat (heap summary), !gcroot <addr> (object roots)
Hang / Deadlock Diagnosis
- Attach or open dump, load SOS
- List all threads:
!threads, identify waiting threads with !syncblk (sync block table)
- Detect deadlocks:
!dlk (SOS deadlock detection)
- Inspect thread stacks:
~Ns !clrstack for specific thread N
- Check wait reasons:
!waitchain for COM/RPC chains, !mda for MDA diagnostics
High CPU Triage
- Attach to live process or collect multiple dumps 10-30 seconds apart
- Use
!runaway to identify threads consuming the most CPU time
- Inspect hot thread stacks:
~Ns kb (native stack), ~Ns !clrstack (managed stack)
- Look for tight loops, blocked finalizer threads, or excessive GC
Memory Pressure Investigation
- Open dump, load SOS
- Managed heap:
!dumpheap -stat (type statistics), !dumpheap -type <TypeName> (filter)
- Find leaked objects:
!gcroot <address> (trace GC roots to pinned or static references)
- Native heap:
!heap -s (heap summary), !heap -l (leak detection)
- LOH fragmentation:
!eeheap -gc (GC heap segments)
Report Template
## Diagnostic Report
**Symptom:** [crash/hang/high-cpu/memory-leak]
**Process:** [name, PID, bitness]
**Dump type:** [full/mini/live-attach]
### Evidence
- Exception: [type and message, or N/A]
- Faulting thread: [ID, managed/native, stack summary]
- Key stacks: [condensed callstack with module!function]
### Root Cause
[Concise analysis backed by stack/heap evidence]
### Recommendations
[Numbered action items]
Guardrails
- Do not claim certainty without callee-side evidence
- Do not call it a deadlock unless lock/wait evidence supports it
- Preserve user privacy: do not include secrets from environment blocks in reports
Cross-references: dotnet-tooling for .NET SDK diagnostic tools (references/profiling.md) and GC/memory tuning (references/gc-memory.md).
References
1---2name: dotnet-debugging3description: Debugs Windows and Linux/macOS applications (native, .NET/CLR, mixed-mode) with WinDbg MCP (crash dumps, !analyze, !syncblk, !dlk, !runaway, !dumpheap, !gcroot, BSOD), dotnet-dump, lldb with SOS, createdump, and container diagnostics (Docker, Kubernetes). Hang/deadlock diagnosis, high CPU triage, memory leak investigation, kernel debugging, and dotnet-monitor for production. Spans 17 topic areas. Do not use for routine .NET SDK profiling, benchmark design, or CI test debugging.4license: MIT5---67# dotnet-debugging89## Overview1011Windows and Linux/macOS debugging using WinDbg MCP tools (Windows), dotnet-dump, and lldb with SOS (Linux/macOS). Applicable to any application -- native, managed (.NET/CLR), or mixed-mode. Includes container diagnostic patterns for Docker and Kubernetes. Guides investigation of crash dumps, application hangs, high CPU, and memory pressure through structured command packs and report templates.1213**Platforms:** Windows (WinDbg MCP, cdb), Linux/macOS (dotnet-dump, lldb with SOS, createdump, dotnet-monitor).1415## Routing Table1617| Topic | Keywords | Description | Companion File |18|-------|----------|-------------|----------------|19| MCP setup | MCP server, WinDbg, configuration | MCP server configuration | references/mcp-setup.md |20| MCP access | MCP access, tool IDs, dispatch | MCP access patterns | references/access-mcp.md |21| Common patterns | debug patterns, SOS, CLR | Common debugging patterns | references/common-patterns.md |22| Dump workflow | dump file, .dmp, crash dump | Dump file analysis workflow | references/dump-workflow.md |23| Live attach | live process, cdb, attach | Live process attach guide | references/live-attach.md |24| Symbols | symbol server, .symfix, PDB | Symbol configuration | references/symbols.md |25| Sanity check | verify, environment, baseline | Sanity check procedures | references/sanity-check.md |26| Scenario packs | command pack, triage, workflow | Scenario command packs | references/scenario-command-packs.md |27| Capture playbooks | capture, procdump, triggers | Capture playbooks | references/capture-playbooks.md |28| Report template | diagnostic report, evidence | Diagnostic report template | references/report-template.md |29| Crash triage | crash, exception, access violation | Crash triage | references/task-crash.md |30| Hang triage | hang, deadlock, freeze | Hang triage | references/task-hang.md |31| High-CPU triage | high CPU, runaway thread, spin | High-CPU triage | references/task-high-cpu.md |32| Memory triage | memory leak, heap, LOH | Memory leak triage | references/task-memory.md |33| Kernel debugging | kernel, BSOD, bugcheck | Kernel debugging | references/task-kernel.md |34| Unknown triage | unknown issue, general triage | Unknown issue triage | references/task-unknown.md |35| Linux debugging | dotnet-dump, lldb, createdump, container | Linux/macOS debugging, dotnet-dump, lldb SOS, containers | references/linux-debugging.md |3637## Scope3839- Crash dump analysis (.dmp files) on Windows, Linux, and macOS40- Live process attach (cdb on Windows, lldb on Linux/macOS)41- Hang and deadlock diagnosis (thread analysis, lock detection, wait chains)42- High CPU triage (runaway thread identification)43- Memory pressure and leak investigation (managed heap, native heap)44- Kernel dump triage (BSOD / bugcheck analysis, Windows)45- Container diagnostics (dotnet-dump in Docker/Kubernetes, sidecar patterns)46- Production diagnostics (dotnet-monitor REST API, trigger-based collection)47- SOS commands across all platforms (WinDbg, dotnet-dump, lldb)48- Structured diagnostic reports with stack evidence4950### Boundary with `dotnet-tooling`5152Both skills use overlapping tools (dotnet-dump, dotnet-counters, dotnet-trace) but for different purposes:5354| Scenario | Use this skill (debugging) | Use `dotnet-tooling` |55|----------|---------------------------|---------------------------|56| Investigating a crash dump (.dmp) | Yes | No |57| "Why did my app crash/hang/OOM?" | Yes | No |58| Attaching a debugger to a live process | Yes | No |59| "How do I profile my app's performance?" | No | Yes (profiling) |60| "How do I reduce GC pressure?" | No | Yes (gc-memory) |61| Collecting a dump for later analysis | Yes | No |62| Running dotnet-counters to monitor metrics | No | Yes (profiling) |63| Analyzing a dump with dotnet-dump | Yes | No |64| Decompiling an assembly to understand behavior | No | Yes (ilspy-decompile) |6566Rule of thumb: if something is **broken** (crash, hang, deadlock, OOM), route here. If something is **slow** or needs **optimization**, route to `dotnet-tooling`.6768## Out of scope6970- Performance profiling (dotnet-counters, dotnet-trace for optimization) -> `dotnet-tooling`71- GC tuning and managed memory optimization -> `dotnet-tooling`72- Assembly decompilation (ILSpy) -> `dotnet-tooling`73- Performance benchmarking and regression detection -> `dotnet-testing`74- Application-level logging and observability -> `dotnet-devops`75- Unit/integration test debugging -> `dotnet-testing`7677## MCP Tool Contract7879These tool IDs are the WinDbg MCP server's exported names (single-underscore `mcp_...`), not the `mcp__...` dispatch prefix used by some hosts.8081| Operation | Purpose |82|-----------|---------|83| `mcp_mcp-windbg_open_windbg_remote` | Attach to a live debug server |84| `mcp_mcp-windbg_open_windbg_dump` | Open a saved dump file |85| `mcp_mcp-windbg_run_windbg_cmd` | Execute debugger commands |86| `mcp_mcp-windbg_close_windbg_remote` | Detach from live session |87| `mcp_mcp-windbg_close_windbg_dump` | Close dump session |8889## Diagnostic Workflow9091### Preflight: Symbols9293Before any analysis, configure symbols to get meaningful stacks:94951. Set Microsoft symbol server: `.symfix` (sets `srv*` to Microsoft public symbols)962. Add application symbols: `.sympath+ C:\path\to\your\pdbs`973. Reload modules: `.reload /f`984. Verify: `lm` (list modules -- check for "deferred" vs "loaded" status)99100Without correct symbols, stacks show raw addresses instead of function names.101102### Crash Dump Analysis1031041. Open dump: `mcp_mcp-windbg_open_windbg_dump` with dump file path1052. Load SOS for managed code: `.loadby sos clr` (Framework) or `.loadby sos coreclr` (.NET Core)1063. Get exception context: `!pe` (print exception), `!analyze -v` (automatic analysis)1074. Inspect threads: `~*e !clrstack` (all managed stacks), `!threads` (thread list)1085. Check managed heap: `!dumpheap -stat` (heap summary), `!gcroot <addr>` (object roots)109110### Hang / Deadlock Diagnosis1111121. Attach or open dump, load SOS1132. List all threads: `!threads`, identify waiting threads with `!syncblk` (sync block table)1143. Detect deadlocks: `!dlk` (SOS deadlock detection)1154. Inspect thread stacks: `~Ns !clrstack` for specific thread N1165. Check wait reasons: `!waitchain` for COM/RPC chains, `!mda` for MDA diagnostics117118### High CPU Triage1191201. Attach to live process or collect multiple dumps 10-30 seconds apart1212. Use `!runaway` to identify threads consuming the most CPU time1223. Inspect hot thread stacks: `~Ns kb` (native stack), `~Ns !clrstack` (managed stack)1234. Look for tight loops, blocked finalizer threads, or excessive GC124125### Memory Pressure Investigation1261271. Open dump, load SOS1282. Managed heap: `!dumpheap -stat` (type statistics), `!dumpheap -type <TypeName>` (filter)1293. Find leaked objects: `!gcroot <address>` (trace GC roots to pinned or static references)1304. Native heap: `!heap -s` (heap summary), `!heap -l` (leak detection)1315. LOH fragmentation: `!eeheap -gc` (GC heap segments)132133## Report Template134135```136## Diagnostic Report137138**Symptom:** [crash/hang/high-cpu/memory-leak]139**Process:** [name, PID, bitness]140**Dump type:** [full/mini/live-attach]141142### Evidence143- Exception: [type and message, or N/A]144- Faulting thread: [ID, managed/native, stack summary]145- Key stacks: [condensed callstack with module!function]146147### Root Cause148[Concise analysis backed by stack/heap evidence]149150### Recommendations151[Numbered action items]152```153154## Guardrails155156- Do not claim certainty without callee-side evidence157- Do not call it a deadlock unless lock/wait evidence supports it158- Preserve user privacy: do not include secrets from environment blocks in reports159160Cross-references: `dotnet-tooling` for .NET SDK diagnostic tools (`references/profiling.md`) and GC/memory tuning (`references/gc-memory.md`).161162## References163164- [WinDbg MCP](https://github.com/anthropics/windbg-mcp) -- MCP server for WinDbg integration165- [WinDbg Documentation](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/) -- Microsoft debugger documentation