2

I'm writing a distributed app and testing requires that I run more than one instance at a time.

Is it possible to debug two or more distinct instances of the same project (at the simplest, passing in different command-line options)?

spender
  • 117,338
  • 33
  • 229
  • 351

1 Answers1

2

Yes, attach to both processes (Debug -> Attach to Process). They will appear under the Processes debug window and their threads will be grouped/headed by process in the Threads window.

Kieren Johnstone
  • 41,277
  • 16
  • 94
  • 144
  • Any way to make this less cumbersome? That's quite some number of clicks. – spender Nov 14 '12 at 14:56
  • 1
    You could bind a shortcut key to Attach to Process, or put a `Debugger.Launch` call at the start of the process, it will prompt you to attach – Kieren Johnstone Nov 14 '12 at 14:57
  • See also Manuel's answer here, you may be able to write a macro like this one: http://stackoverflow.com/questions/9030071/visual-studio-2010-automatic-attach-to-process – Kieren Johnstone Nov 14 '12 at 14:58
  • Now we're talking. `Debugger.Launch` looks good. Didn't know about that. Thanks. – spender Nov 14 '12 at 14:58
  • I think I'll add a compilation symbol in a new project configuration and call `Debugger.Launch` wrapped in `#if`/`#endif`. That will work nicely for me. Thanks again. – spender Nov 14 '12 at 15:03
  • Good tip :) didn't know about this myself – Charleh Nov 14 '12 at 16:07