Simplified Process Attaching – Reattach to Process in Visual Studio 2017

Simplified Process Attaching – Reattach to Process in Visual Studio 2017

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.

 

Reattach to Process in Visual Studio 2017
Reattach to Process in Visual Studio 2017

 

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

Reattach To Process - Attaching Flow
Reattach To Process – Attaching the Process Flow

You can follow these simple steps to test it out.

  1. Run  your application in Visual Studio.
  2. Attach to a specific process to it for debugging.
  3. Stop the debugging.
  4. 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.

 

List of Attached Process
List of Attached Process

Hope this helps !

 

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

3 Comments to “Simplified Process Attaching – Reattach to Process in Visual Studio 2017”

Comments are closed.