10

From today morning, my Visual Studio is behaving very strangely. I get the error "one or more errors occurred failed to launch debug adapter" whenever I run the project.

enter image description here

I run my project profile instead of running it in the IIS Express profile. Here is my launchSettings.json file.

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:65498",
      "sslPort": 44318
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "<ProjectName>": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://localhost:5001;http://localhost:5000"
    }
  }
}

And when I check the Output window, this is what I get.

The program '[22052] .exe' has exited with code -1 (0xffffffff).

Another thing I noticed is that a new browser tab is opened without any URL in it, just an about:blank page.

Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140
  • I too am having the same issue when its been working fine for ages. Suddenly after an Edge update it stopped working; I dont have a console window and I dont have a browser window open. The only solution is to change to Chrome. What is weird is that it works the first time after a reboot, and then second time onwards its broken. – Samuel Johnson Mar 09 '21 at 20:20

5 Answers5

9

I am having this problem too and think it may have something to do with the Edge Browser(or an update?) and the JavaScript Debugger. The first time I run a WebApp, everything works fine. Every time afterwards, I receive the "failed to launch debug adapter" shown above.

I have to either disable the Javascript Debugger or Use Internet Explorer to run the app.

enter image description here

zBestData
  • 190
  • 1
  • 7
5

The issue was that the process that got started from my previous execution was still running. When we start the project using the profile project, it will start a new process, and you can see that there is a new Debug console window as in the preceding image.

enter image description here

You can just close this window and run your project again, and that will fix the issues. You can also enable a setting that will close this process when the debugging stops. To do that, go to Tools and then click on Options, select Debugging and then enable the option Automatically close the console when debugging stops.

enter image description here

If you don't see the option, just click on the other options under the Debugging menu, and wait for the contents to load, and then click on the Debugging menu again. Sometimes it was just showing a blank screen without any options. Seems like a bug in Visual Studio 2019.

Also, make sure to close the browser window that was opened from the last execution. For me it was opened, that is the reason why a new tab with about: blank was opening.

Happy Coding!.

Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140
  • This hasn't fixed it for me unfortunately. Tried with both VS 2019 and VS 2020 Preview 2.1 everything was working fine and from one day to another the issue started happening. VS starts the browser window blank and fails to detect in what port the IIS is running. As such it tries to connect the debugger to the wrong port and gets connection refused. If I manually navigate in that same browser window to the IIS Express page, I can load it, but Debug still doesn't work. – Ralms Aug 10 '21 at 17:34
2

We're having the same problem as zBestData above since moving to Visual Studio 2019, Version 16.9.1.

We don't have much time to look into it at the moment but seems to be related to msedge.exe processes left running after a debug session. As a workaround, before starting a second debug session, close all open Edge windows, then kill any msedge.exe instances (eg in Task Manager).

Otherwise, we find we need to Restart the system to clear the fault.

Nguyễn Văn Phong
  • 13,506
  • 17
  • 39
  • 56
DaveC
  • 81
  • 1
  • 2
  • Same for me after updating to 16.9.3. Reboot Fixed it. (I didn't try just closing Visual Studio and Restarting it alone. That may work as well.) – Thomas Apr 08 '21 at 21:09
1

The issue is most likely with your browser, which acts as debug adapter in this case. Close all instances of your browser.

Explanation:

As the error message indicates, there is additional information in the output window.

Open the visualstudio-js-debugger.txt file. It should be in a location similar to the one below.

Remember to replace your-user-name in the path below with your correct username.

C:/Users/*your-user-name*/AppData/Local/Temp/visualstudio-js-debugger.txt

The file should look as below, take note of the adapter Id, highlighted in red, it is the Chrome Browser. So you can just close all instances of the Chrome Browser in this case. enter image description here

Mwiza
  • 7,780
  • 3
  • 46
  • 42
1

Switch the browser, e.g. to Opera, and it will work. Because the Edge engine can work, for example, in Teams / Outlook and will report a problem.

enter image description here

mih
  • 81
  • 1
  • 4