/dotnet:debuggingfrom dotnet
Use when C# or another CoreCLR program misbehaves at runtime and its cause is unproven (wrong value, failing test, exception, hang, crash, breakpoint that never stops), covering DNCDbg launches and attaches, held starts, test runners, PDB documents, exception stops, expressions, live process reads, and dumps
Ships in dotnet. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Covers C# and every CoreCLR program, test assembly, and component a test loads, debugged under DNCDbg. Use tool:debugging for the method, session answers, and macOS crash reports. Use dotnet:codelens for static reads of a stack trace, a throw site, generated source, or IL, and msbuild:diagnostics for a failing build.
[REFERENCES]:
Facts read before a session, in order:
dncdbg --version answers on the program folder's PATH, else a viewizard/dncdbg release archive installs it beside libdbgshimdotnet build <project> -c Debug writes <dll>, the program or test assembly that runs the code, with the locals and sequence points optimization removes<dll> or the apphost beside it is programQuestion to route:
| [INDEX] | [QUESTION] | [ROUTE] |
|---|---|---|
| [01] | Value or path at a line of a program | launch with line breakpoints ([03]) |
| [02] | Failing test | Test assembly launched with its one-test filter ([05]) |
| [03] | Startup of a program another tool starts | Held start, then attach ([04]) |
| [04] | Running process with state worth keeping | attach by pid ([04]) |
| [05] | Hang or high CPU of a live process | dotnet-stack report ([07]), then attach and pause |
| [06] | Allocation, GC, contention, thread pool rate | dotnet-counters, then dotnet-trace ([07]) |
| [07] | Process died, or a hang to keep | references/dumps.md |
| [08] | Analyzer, code fix, generator | Its verifier test ([05]), breakpoint in the component source |
| [09] | Exception text with a stack trace alone | resolve_stack_trace of dotnet:codelens, then row [01] |
Launch facts:
stop_on_entry: true stops at the first line of Main with its arguments readablefunctions: [{name}] binds Namespace.Type.Method, Type.Method, or Method of a synchronous methodasync method or iterator bind nothing, so the program runs past them: line breakpoint inside itDNCDbg keys settings takes:
| [INDEX] | [KEY] | [EFFECT] |
|---|---|---|
| [01] | justMyCode: false | Frames and steps inside assemblies without symbols |
| [02] | enableStepFiltering: false | step_in enters property accessors and operators |
| [03] | expressionEvaluationOptions.allowImplicitFuncEval | false shows values without running getters |
| [04] | expressionEvaluationOptions.allowToString | false shows values without ToString() or display attributes |
| [05] | stopAtEntry: true | Attach to a held start stops at Main |
Values display through ToString(), [DebuggerDisplay], and getters, each run at the stop. With implicit evaluation off, <expression>,ac runs one.
Held start, for code that runs before an attach could reach it:
DOTNET_DefaultDiagnosticPortSuspend=1 <command> &
Main, prints The runtime has been configured to pause during startup, and $! is <pid>dotnet run and dotnet test hold the CLI itselfDebugger.Launch() starts no debugger on macOS: it returns true and Debugger.IsAttached stays falseAttach readings:
DOTNET_EnableDiagnostics=0get-task-allow, as DNCDbg reads the runtime over its pipesTest assemblies run one test under launch of <tests.dll> with exceptions: ["user-unhandled"], which stops at the failing assertion:
| [INDEX] | [RUNNER] | [SIGN] | [ARGS] |
|---|---|---|---|
| [01] | xunit.v3 | <tests> --help lists -method | ["-method", "<Namespace.Class.Method>"] |
| [02] | Microsoft.Testing.Platform | <tests> --help lists --filter | ["--filter", "<expression>"] |
| [03] | VSTest | testhost.dll beside it, no apphost | None, held host and attach in place |
<tests> -list methods (xunit.v3) and <tests> --list-tests (platform) print the names a filter takes--filter takes FullyQualifiedName~<name> where the framework reads VSTest filters, other frameworks name their option in --helpread scopes of frame <i> readsxunit.v3 turn off under a debuggerVSTest holds its host on VSTEST_HOST_DEBUG=1 dotnet test <project> --filter "FullyQualifiedName~<name>", which prints Process Id: <pid>, Name: dotnet and waits for the attach. A platform test started by another tool takes --debug or TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1 and prints Waiting for debugger to attach... Process Id: <pid>.
DNCDbg's exception filters:
| [INDEX] | [FILTERS] | [STOPS] |
|---|---|---|
| [01] | None | Unhandled exception, unwound |
| [02] | ["user-unhandled"] | Exception leaving project code for code without symbols |
| [03] | ["all"] | Every throw, caught ones and library throw helpers included |
Readings:
[External Code] frames stand for runtime and library frames under Just My Code[Exception] <method>, unwound, with scopes refused 0x80004005: launch again with exceptions: ["all"]$exception evaluates the exception in flight, and each frame's scope lists it as a local$pid and $tid evaluate in a condition, $tid == <id> holding a breakpoint to one threadawait run on a thread-pool thread, the awaiting caller absent until its continuation runs: breakpoint in the callerstepOut refused with 0x80004005 in an async ValueTask method or async iterator after an await -> breakpoint in the caller, continuehit: "<n>" stops from hit <n>+1 in DNCDbg 1.3.0, which reads no ==, >=, or % and stops on every hit given oneoutput: [stderr] Breakpoint error: The condition ... will be removed, then every hitevaluate answers at a stop firstevaluate {expression: <local>, value} sets a local, and an init property refuses cannot be assigned toExpressions DNCDbg answers and refuses:
| [INDEX] | [FORM] | [ANSWER] | [IN_ITS_PLACE] |
|---|---|---|---|
| [01] | Local, member chain, indexer (items[0].Name) | Yes | |
| [02] | Instance or extension call (text.ToUpper(), items.First()) | Yes | |
| [03] | Arithmetic, == between values, && | Yes | |
| [04] | Static call, each argument of its parameter's exact type | Yes | |
| [05] | new T(<arguments>), format specifiers ,h, ,nq, ,ac | Yes | |
| [06] | Static call converting an argument (List<T> to IEnumerable<T>) | 0x80070057 | Instance or extension call |
| [07] | null comparison, is, cast | No | Value the local prints, GetType() |
| [08] | Lambda, ?:, typeof, nameof, default, ++ | No | Expression without them |
| [09] | Enum member by name | No | Local holding it |
Refused expressions say nothing about the program.
Reads of a live process that stop nothing, through the socket $TMPDIR/dotnet-diagnostic-<pid>-*-socket the runtime opens:
dotnet-trace ps lists processes this shell's TMPDIR reachesUnable to connect to Process <pid>, or <pid> missing from dotnet-trace ps -> TMPDIR=<folder> <tool>, with <folder> from the target:ps eww -o command= -p <pid> | tr ' ' '\n' | rg '^TMPDIR='
| [INDEX] | [COMMAND] | [ANSWER] |
|---|---|---|
| [01] | dotnet-stack report -p <pid> | Managed frames of each thread |
| [02] | dotnet-counters collect -p <pid> --format json --duration 00:00:00:10 -o <file>.json | Runtime rates over 10 seconds |
| [03] | dotnet-trace collect -p <pid> --duration 00:00:00:10 -o <file>.nettrace | Sampled stacks |
| [04] | dotnet-trace report <file>.nettrace topN -n 20 | Methods by exclusive samples |
dotnet-stack prints running frames alone, never queued work or an awaiting methodjq -r '.Events[] | "\(.name) \(.value)"' <file>.json reads counters (dotnet.monitor.lock_contentions, dotnet.thread_pool.queue.length)topN samples every thread, so wait frames rank high and --inclusive ranks callersdd:hh:mm:ssReadings and the next action:
bound and no stop in code that ran -> read modules names the copy loaded and its PDB, then the document check belowpending in a Release build after an attach -> methods ran optimized before it: held start or launchpending, The breakpoint will not currently be hit. No symbols ... -> module reads Symbols not found., no PDB beside or inside it: build againerror: unknown option: <option> (xunit.v3) or Unknown option '<option>' (platform) -> runner refused its arguments: <tests> --helpDocument check of an assembly through ilspycmd (dotnet tool install -g ilspycmd), every source file it compiled with its SHA-256:
ilspycmd --dump-pdb --json --disable-updatecheck <dll> | jq -r '.documents[] | "\(.url) \(.hash)"'
shasum -a 256 <file>
Cleanup beside tool:debugging: held starts and held test hosts never attached end by their pid, and dump, trace, counter, and TestResults files go.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub bsamiee/rasm --plugin dotnet8 skills in this plugin
/mapperlyUse when writing or reviewing a Mapperly mapper, covering mapping at the host boundaryOther plugins' skills for the same job