visual-studioiisattach-to-process

Attach to Process Error: A device attached to the system is not functioning


I am not sure what I did to get my "Attach to Process" feature of VS2019 to stop working. Last week it worked and now this week it doesn't.

Steps to Produce Issue:

  1. Open VS2019
  2. Debug -> Attach to Process
  3. Find w3wp.exe in the Available Processes window.
  4. Select/Highlight it and click Attach.

What happens:

This error window pops up: enter image description here

I randomly tried to attach to other processes and VS continued to do what's expected (i.e. it successfully attaches). This leads me to believe that there is an issue with IIS. And maybe not an "issue" but a setting that is turned on or off which prevents VS from successfully attaching.

Tried and Fail Solutions

  1. I tried unplugging everything from my laptop.
  2. Uninstalling third party extensions that I added.
  3. Restarting VS.

Solution

  • I noticed that after some WPF applications were started and ended there can be left over tasks in the task list. My guess was that those might be in the state "Zombie" or something. Depending on the application some do show them (eg. Visual Studio and tasklist.exe) but others not (eg. Task Manager). In the Visual Studio Attach function you can even attach to these zombie processes and then you will get exactly this error box. But you can distingish the zombie processes by looking at the 'Type' column. A real process has "Managed (v..), x86" while the zombies display only 'x86'. In taskkill.exe you also get an error message if you try to kill one of these zombies. After you killed a real process you will see it listed as zombie. It doesn't disappear.