# Sample: debugging a running .NET application with WinDbg and an AI agent

PricingService prices an order every 500 ms. After a few seconds, some orders fail with "Invoice total cannot
be negative", and more and more of them fail over time. The process never stops, it only logs the error.

    dotnet run --project PricingService --configuration Release

The first line prints the process id. Let it run for a minute, then open the agent in this folder and ask:

    PricingService (process id 1234) logs "Invoice total cannot be negative" for more and more orders.
    Attach to it and find the root cause.

WinDbgMcp is an MCP server that keeps a cdb.exe session alive between tool calls, which is what makes
breakpoints usable by an agent. .mcp.json registers it for Claude Code; the tools are attach, execute, wait,
break and detach.

.claude/skills/debugging-live-dotnet-processes/SKILL.md is the skill the agent uses. Claude Code and GitHub
Copilot read it from that path as is; for Codex, move the folder to .agents/skills/.

Prerequisites: Windows, the .NET 10 SDK, WinDbg, and SOS:

    winget install Microsoft.WinDbg
    dotnet tool install --global dotnet-debugger-extensions
    dotnet-debugger-extensions install --accept-license-agreement

WinDbgMcp starts cdbX64.exe (or cdbARM64.exe on ARM64), and loads %USERPROFILE%\.dotnet\sos\sos.dll. Set the
CDB_PATH and SOS_PATH environment variables to use other files.
