Attach to Process in Visual Studio 2017 not working


Problem Statement

I started seeing a weird issue while working in Visual Studio 2017 few days back. I was not able to attach to running processes with the Visual Studio debugger. The IDE used to freeze/hung each time I tried to do so. The ‘Attach to Process‘ window used to come up but it was blank and all I saw was the spinner – eventually the screen became unresponsive after some time. The only way out was to end the Visual Studio 2017 process using the Task Manager.

Attach to Process Not working

Troubleshooting the issue

I had both Visual Studio 2015 and 2017 versions installed, and I was able to replicate this issue in both versions. This was blocking my work, so I went ahead and reported the issue to the Visual Studio Team —
https://developercommunity.visualstudio.com/content/problem/117739/attach-to-running-process-not-working-and-geting-h.html

In the meanwhile, I was trying to figure out the root cause of the problem. I had downloaded the Visual Studio 2017 Preview to check on the latest features not available in VS2017 — https://www.visualstudio.com/vs/preview/

I tried uninstalling VS 2017 Preview but it did not help. I tried uninstalling VS 2017 – it did not help either. At least I was able to confirm that installing multiple versions of Visual Studio did not cause this issue.

I noticed that randomly I was getting a pop up message while starting Visual Studio to install Windows Management Framework v3. Upon clicking on Yes, it used to redirect me to the website having files to be downloaded. The bad part was the site did not have the correct download files for Windows 7. Hence I did not spend time to research and install it, since I was not 100% if I needed it, since everything else was working fine.

Windows Management Framework

I again received the message this morning, and I decided to search for the correct file to install and get done with this pop-up message.

I was able to get the installation steps for my Windows 7 machine here —
https://support.microsoft.com/en-us/help/2506143/description-of-windows-management-framework-3-0-for-windows-7-sp1-and

Reading through the documentation on the site it said that the Windows Management Framework 3.0 update enables you to use the following features on a computer that is running Windows 7 SP1 or Windows Server 2008 R2 SP1: 
— Windows PowerShell 3.0
— Windows Management Instrumentation (WMI)
— Windows Remote Management (WinRM)
— Management OData IIS Extension
— Server Manager CIM Provider

Once the framework was updated, I rebooted my box. With fingers crossed, I opened my Visual Studio IDE and checked to see if something magical happened and if I was able to attach to the running processes.

And Yes, it actually fixed the issue!

I got back my usual Attach to Process window listing all the running processes —

Attach to Process works

The issue is resolved finally. But I still do not understand this dependency on this Windows Management Framework 3.0. Probably I will post this question to the Visual Studio Developer Community thread for the original issue, and understand it better.

Crazy Problem and Crazy resolution. But for now I am all up and running – and ready to debug some code 🙂 



Categories: C#, Visual Studio, Visual Studio 2017

Leave a Reply