Attaching to a process during debugging, is one of the very common task. We can attach the Visual Studio debugger to a running process by navigating from Debug > Attach to Process (Ctrl+Alt+P) and then select specific process from the Attach to Process dialog box. This could be a repetitive process during the development and debugging of your application. You may need to stop the debugging, then attach again next time with some modification in code. Visual Studio simplified this process attaching mechanism by introducing Reattach to Process.
Now, you can attach the process using Attach to Process window only once, then use the “Reattach to Process” (Shift+Alt+P) to attach it again.
The debugger will reattach by first attempting to match the previous process ID and then, if that fails, by matching to the previous process name. If no matches are found, or if there are multiple processes found with the same name, then the Attach to Process dialog box will appear so that you can select the correct process. Reference Text From – Attach to Running Processes with the Visual Studio Debugger
You can follow these simple steps to test it out.
- Run your application in Visual Studio.
- Attach to a specific process to it for debugging.
- Stop the debugging.
- You will find “Reattach to Process“ option under Debug menu, select the option, to start your debugging which attached the previously attached process automatically.
Related Post: How to get list of attached processes in Visual Studio while debugging ?
During Debugging, you can navigate to Debug > Windows > Processes to find out which are the process currently attached.
Hope this helps !
Pingback: Dew Drop - July 3, 2017 (#2512) - Morning Dew
Pingback: dailydotnettips.com Daily .NET Tips | Top Domains Info
Pingback: Did you know – “Attach to Process” dialog window now has a “Process Filtering” option in Visual Studio 2017 ?