Cyberiafreak

"Fortunate are those who take the first steps.” ― Paulo Coelho

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

About these ads

January 3, 2014 - Posted by | .NET General

1 Comment »

  1. Excellent!

    Two things…
    It threatened me at first shot by throwing a dialog ‘Unhandled Exception’.

    Comment by Bala | February 28, 2014 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: