New Improved Attach to Process Dialog Experience

Harshada

With Visual Studio 2022, we promise to bring new tooling to improve the inner loop productivity and debugging experience. In addition, we have several exciting debugging updates, and the new Attach to Process dialog experience is one of them.

We have added command-line details, app pool details, parent/child process tree view, and the select running window from the desktop option in the attach to process dialog. These make it convenient to find the right process you need to attach. Also, the Attach to Process dialog is now asynchronous, making it interactive even when the process list is updating. All these features should be available in the latest Visual Studio 2022 preview version.

Let’s check them out!

Command-Line and AppPool details in Attach to Process dialog

When debugging multiple ASP.NET Core applications, numerous instances will show as dotnet.exe’s in the available process list.

Similarly, when you have multiple web applications running with multiple application pools on your machine, they will create multiple worker processes (W3WP.exe). To make sure the Visual Studio debugger pauses at your breakpoint you need to select the right worker process that belongs to the target web application.

For both the above scenarios, figuring out the process to attach to was challenging. To find the right process you will need to get the PID using tools such as Task Manager and then use command line details to determine the right dotnet.exe process or use appcmd.exe utility to determine which PID belongs to which IIS process. Finally, select that process in the attach to process dialog to attach with the debugger.

Starting VS2022 Preview 2 you will see all these details in the Attach to Process dialog itself. We have added a new Command-Line column or App Pool details in the Title column when applicable, so you don’t need to go back and forth with other tools to differentiate between identical-looking processes.

Attach to process Dialog: AppPool details in the Title column

Attach to Process dialog: AppPool details in the Title column

Automatic refresh Process View

When checked, the auto-refresh checkbox will refresh the process list automatically with the available processes. Thus, the process list gets updated asynchronously and gives the updated processes in real-time.

 

Show Process Tree

This checkbox will swap out available processes flat list to hierarchical parent-child view. This could be helpful when the application you are debugging spawns multiple processes.

For e.g. if you are trying to debug Chromium, it can become challenging because of its multi-process architecture. When you select Run in the debugger, by default only the main browser process will be debugged. The code that renders web pages will be in separate child processes. The new process tree view can show you how these processes are related, making it easy to identify the right child process to attach to.

Attach to process Dialog: Process Tree View  

Attach to Process dialog: Process Tree View

Attach to running process from the desktop

The “Select Window” button under the Available Process lets you pick any running window/application and attach it to its associated process.

You don’t need to know the process name associated with that application or need to search through the processes list; you can conveniently point to the window on your desktop and attach it to the process in just couple of clicks.

A picture containing text, computer, computer, indoor Description automatically generated

Attach to Process dialog: Select running window process

Your feedback matters!

We want your help making Visual Studio 2022 the best developer experience for you. We encourage you to download Visual Studio 2022 Preview and try out these features. We appreciate your time in providing feedback via Developer Community, reporting a problem.

 

6 comments

Leave a comment

  • Valii Valentin

    Maybe new but not improved, many times when attaching to a net integrated w3wp process will very often and maybe randomly crash and bring to the end of all the visual studio 2022 process and w3wp together, which never happen while doing the same thing with vs2019 and older. Can you fix this

  • Theo Albers

    We typically use ASP.NET Core projects with vue-cli for the front end. Debugging the REST API’S works like a charm. Debugging the SPA website is more of a console.log experience. Edge/Chrome developer tools kind of works. Is there any tlc for smooth front end debugging with VS2022?

  • Stefano Pietrosanti

    I would love for the “Reattach to Process” menu item to persist between sessions on the same Visual Studio solution. It is a minor inconvenience but it helps saving time re-selecting a process, and it also helps when re-opening solutions I haven’t worked with in a while.