I have an application that spawns a new process. During development of the application, I would like to attach a debugger to the new process. Currently I can do that through Visual Studios Attach to Process functionality, but it's a pain to go back and attach it manually every single time when I need to test a minor change to the code.
Is it possible to spawn a new process using Process.Start and then attach any debuggers that are currently attached to the current process onto the new process?
I.E.:
Start Process1 with debugging enabled
Process1 starts Process2
Process1 attaches the debugger to Process2
Not a very clean solution, but you could do something like this:
Debugger.IsAttached
), pass an argument to Process2 (e.g. process2.exe /debug
)/debug
argument, attach the debugger from code (Debugger.Launch()
)