I have an application that occasionally requires you to restart it after changing preferences. I do this by calling:
System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
That's great for the released version, but it's really annoying when I'm debugging and it relaunches the program outside the debugger whenever I need to change the preferences.
After some research, I've tried attaching to the debugger from code, but the very code I'm trying to run is running in the debugger already, and the application will be killed shortly. So I wrote an external program that can be called after relaunching the application (and freeing up the debugger) that supposedly attaches it to the debugger. Unfortunately this doesn't really do the job either. It appears to get attached to the debugger, but it doesn't actually let me do any debugging. It just craps out with an error if I try to pause execution.
Any ideas?
After more research, I realized all I wanted to do was programmatically hit the Restart button. I found this:
Works great!