I have an MMC snap-in that I am trying to debug. Currently, the following code, placed in the snap-in's constructor, works in terms of attaching the debugger to it:
public MySnapIn()
{
#if DEBUG
if (!Debugger.IsAttached)
{
Debugger.Launch();
}
#endif
...
}
But its really annoying to always have to attach a debugger to Visual Studio. I want to automate this process. Ideally, I would just have to hit F5 and it automatically attaches the debugger. I have tried the following:
- Project Properties -> Start external program -> typed in "C:\Windows\System32\mmc.exe"
- Project Properties -> Command line arguments -> Gave it a path to a .msc file (stores snap-in layout so it makes it easier to load it every time, so that you don't always have to File -> Add/Remove Snap-in).
This didn't work. The debugger won't attach automatically. How can I automate this process, or what's blocking the debugger from attaching automatically?
Debugger.Launch()
). I didn't know that was possible. – Newsom