This still provides a prompt, but attaches a debugger:
if (!Debugger.IsAttached && DebuggerFlagSet()) Debugger.Launch();
and then in the parent process
if(Debugger.IsAttached) SetDebuggerFlag()
You will need a mechanism for the debugger flag, such as a file on disk / reg-key / mutex, etc.
The debugger will not be the same as the original one.
source share