You did not indicate which language you are using. But if you use C # or VB.NET, you can add Debug.Break () or Stop to trigger a request to attach the debugger to the process.
Or, as mentioned above, just use something like Console.Readline () or MessageBox.Show () to pause the process until you can connect a debugger to it.
source
share