What is the Diagnostics IPC channel, and how do diagnostic tools like dotnet-trace connect to a running .NET process without a debugger?
Short answer
Every .NET process exposes a diagnostics IPC (inter-process communication) channel automatically at startup (a named pipe on Windows, a Unix domain socket on Linux/macOS), which diagnostic tools like dotnet-trace, dotnet-counters, and dotnet-dump connect to in order to send…
Advertisement
AModel answer
Every .NET process exposes a diagnostics IPC (inter-process communication) channel automatically at startup (a named pipe on Windows, a Unix domain socket on Linux/macOS), which diagnostic tools like dotnet-trace, dotnet-counters, and dotnet-dump connect to in order to send commands and receive data -- this out-of-process design means diagnostics can be performed on a live production process without attaching an invasive debugger or restarting the application.
Example
# List processes with an active diagnostics IPC channel dotnet-trace ps # Connect to a specific process and start collecting dotnet-trace collect --process-id 1234
Real-world example
An operations team runs dotnet-trace ps to discover all currently running .NET processes across a shared server, then attaches diagnostics to a specific one experiencing issues, all without any prior instrumentation or restart.
Likely follow-ups
- How is the diagnostics IPC channel secured against unauthorized access?
- What happens if a process was started before diagnostics tools existed on the machine?
Related topics