Macro for attaching to a process

When debugging aspnet solutions a lot of time is wasted on restarting the debugged application.  A real time saver is to connect to the process to avoid restarting.

This is done like so:

– When a new bug is found don’t stop the web browser, instead detach from the process (menu->detach->detach all).
– Update the code to correct the bug.
– Set a breakpoint.
– Connect (menu->attach to process->[find the process, it is called something like iis or aspnet]->attach) to the process.
– Reload the web browser.

There are some caveats.  Like when using Webform the viewstate is tightly connected to the controls on the form so it is not always possible to connect.

But for the most times this is a great time saver.


When you have done this a couple of times even this takes long time.  So fire up the macro recorder and do the recipe above.  Then run the temporary macro.  Running the macro is way faster than doing it manually.  I guess it is all the GUI stuff that takes time.
Or store the macro in VS and create a button and/or a shortcut.


Update: use shift-ctrl-P to run last macro.  Nice if one is too lazy to create a menu.

Tags: , ,

3 Responses to “Macro for attaching to a process”

  1. Manuel Anaya says:

    – Update the code to correct the bug.
    – Build project (even faster: current solution Ctrl+F6)
    – Set a breakpoint.
    – Build->Attach to process->W3wp.exe (build->attach to process can be also accessed via Ctrl+Alt+P)
    – Reload the web browser.

  2. selfelected says:

    For a video instruction of the same:

  3. […] have earlier, here and here, written about how to write a macro to attach the debugger to a running process as it is often […]

Leave a Reply