How I Finally Discovered when to use Debugger.Break()

The existence of the System.Diagnostics.Debugger class is not something new to me, but I never figured out an usage for it. I never used it, and my knowledge was limited to think that it was a bit useless to code a breakpoint while you could set it in visual studio.

However, this makes quite a lot of sense in some scenarios, like programs that execute too fast, or PowerShell cmdlet that you don’t have a chance to attach to.

Related StackOverflow question: http://stackoverflow.com/questions/1432359/what-are-the-benefits-of-using-system-diagnostics-debugger-break-over-attach-to

Live and learn!

Debugging a WCF Service running in IIS, process not showing in process list

Few days ago, I wanted to debug a WCF service hosted in IIS (on localhost). Sounds simple, just use Visual Studio "Debug > Attach to Process…" command (Ctrl + Alt + P).

However, aspnet_wp.exe (running Windows XP) was not displayed in the list of running processes (while the "Show processes from all users" was checked).

So I started crawling the web to find why this process didn’t show up in the list. And the answer was very simple: this process is not started if no request has been made yet. Simply heading to the .svc URI of the service started the process, which was then available in the list of processes.