How to attach Visual studio dynamically
I never thought this would be so easy with this couple of statements. All these days, I used to put a hard coded message box thrown up and then try to attach manually VS by selecting that new process. But this one is very useful if you want to do automatically break in VS.
if (!Debugger.IsAttached) Debugger.Launch(); Debugger.Break();
This would be useful if you are debugging multiple process in the Visual Studio – Ley say you HelloWorld.exe is creating a new exe LogViewer.exe and yourself want to debug end to end all in same VS. More at MSDN- http://goo.gl/lKJcUh