An easy way of doing .Net debugging in production environments

Say you want to debug your .Net application on some production enviroment, customer site/server and remote debugging is not an option due to various network issues like firewall, latency, cordoned off network etc. Installing Visual Studio might just take too long even with a minimal install. So what can you do with the least effort? This is a problem I have faced many times as we deploy our in-development servers at our customer sites for testing etc and many a times you'd have to debug issues that show up only in such environments. You don't need something fancy but just enough to be able to load your PDBs and do source level debugging.

Well it turns out that there is an easy low-effort option available instead of installing VS. All you need to do is install the .Net Framework SDK and use the CLR Debugger. Installing the .Net SDK is easier since its faster, smaller and you can always download it off the web if you have connectivity. You will find it as DbgCLR.exe in the GuiDebug directory within the SDK install location.

A couple of tips. You can load PDB files without copying them into the directory from where the process started. Open the modules window (Debug->Window->Modules) and then right click and choose Load Symbols (you can do this only after you have attached the debugger to the process). Using the 2.0 SDK is better since the CLR Debugger in that easily allows you to set the path to look for sources etc and save it in a solution. The CLR Debugger will allow you to do full source level debugging with breakpoints, watches etc. It is a good subset of the VS Debugger.

The only downside is that you can use this only for managed (.Net) debugging and not native Win32 debugging.