Many times this seems to be a problem when a third party application loads my .DLL assembly and starts executing it. I want to place a breakpoint, but before the .DLL is loaded into this third party host, the breakpoint would not be active, and after the component is activated, it might be too late to place the breakpoint in the IDE.
Solution? Use the following code:
And like magic, the debugger will stop here just as if there was a brakepont added.
If you are running this as a Windows application, the application error popup will also appear, allowing you to attach a debugger to the process. You can then just start stepping right from this code line forward.