question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Microsoft Visual Studio Failed to launch debug adapter 'Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.ProtocolException

See original GitHub issue

Describe the bug

I am trying to upgrade my .net core 3.1 based solution to .net 5.0. I am seeing this error with:

  • Microsoft Visual Studio Professional 2019 Version 16.8.2
  • Microsoft Visual Studio 2019 Community version 16.9 Preview 1

Attempting to launch my asp.net core project with visual studio debugger fails:

image

Looking in output window I got a path to the verbose output log, and here is the relevent info:

{"tag":"runtime.launch","timestamp":1606227038803,"message":"Launch returned error","metadata":{"error":{"message":"Unable to launch browser: \"Failed to launch browser!\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n\"","stack":"Error: Unable to launch browser: \"Failed to launch browser!\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n\"\n at k.prepareLaunch (c:\\program files (x86)\\microsoft visual studio\\2019\\preview\\common7\\ide\\commonextensions\\microsoft\\jsdiagnostics\\debugger\\debugAdapter\\out\\src\\targets\\browser\\browserLauncher.js:102:19)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)"},"wasCancelled":false,"name":"k"},"level":2} {"tag":"dap.send","timestamp":1606227041361,"metadata":{"connectionId":0,"message":{"seq":16,"type":"response","request_seq":2,"command":"launch","success":false,"body":{"error":{"id":9240,"format":"Unable to launch browser: \"Failed to launch browser!\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n\"","showUser":false}}}},"level":0} {"tag":"dap.send","timestamp":1606227043301,"metadata":{"connectionId":0,"message":{"seq":17,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"initialize":{"operation":"initialize","totalTime":4.5,"max":4.5,"avg":4.5,"stddev":null,"count":1,"failed":0},"!initialize.errors":[],"initialize.errors":[],"setBreakpoints":{"operation":"setBreakpoints","totalTime":11.3,"max":2,"avg":1.3,"stddev":0.5,"count":9,"failed":0},"!setBreakpoints.errors":[],"setBreakpoints.errors":[],"setExceptionBreakpoints":{"operation":"setExceptionBreakpoints","totalTime":0.5,"max":0.5,"avg":0.5,"stddev":null,"count":1,"failed":0},"!setExceptionBreakpoints.errors":[],"setExceptionBreakpoints.errors":[],"configurationDone":{"operation":"configurationDone","totalTime":0.5,"max":0.5,"avg":0.5,"stddev":null,"count":1,"failed":0},"!configurationDone.errors":[],"configurationDone.errors":[],"launch":{"operation":"launch","totalTime":2932.4,"max":2932.4,"avg":2932.4,"stddev":null,"count":1,"failed":1},"!launch.errors":[{"error":{"message":"Unable to launch browser: \"Failed to launch browser!\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n\"","name":"Error","stack":"Error: Unable to launch browser: \"Failed to launch browser!\n\n\nTROUBLESHOOTING: httptroubleshooting.md\n\"\n at k.prepareLaunch (c:browserLauncher.js:102:19)\n at processTicksAndRejections (internaltask_queues.js:97:5)"}}],"launch.errors":[{"error":{"message":"Unable to launch browser: \"Failed to launch browser!\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n\"","name":"Error","stack":"Error: Unable to launch browser: \"Failed to launch browser!\n\n\nTROUBLESHOOTING: httptroubleshooting.md\n\"\n at k.prepareLaunch (c:browserLauncher.js:102:19)\n at processTicksAndRejections (internaltask_queues.js:97:5)"}}]}}}},"level":0} {"tag":"dap.send","timestamp":1606227043419,"metadata":{"connectionId":0,"message":{"seq":18,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/error","data":{"!error":{"error":{"message":"read ECONNRESET","name":"Error","stack":"Error: read ECONNRESET\n at TCP.onStreamRead (internal/stream_base_commons.js:205:27)"}},"error":{"error":{"message":"read ECONNRESET","name":"Error","stack":"Error: read ECONNRESET\n at TCP.onStreamRead (internal/stream_base_commons.js:205:27)"}},"exceptionType":"uncaughtException"}}}},"level":0} {"tag":"dap.send","timestamp":1606227043419,"message":"Message not sent. Connection was closed.","level":2} {"tag":"runtime.exception","timestamp":1606227043419,"message":"Unhandled error in debug adapter","metadata":{"message":"read ECONNRESET","stack":"Error: read ECONNRESET\n at TCP.onStreamRead (internal/stream_base_commons.js:205:27)"},"level":3}


Here is the relevent section from my launchProfiles.json:

 "MyHost": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "https://localhost:62808/",
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "http://localhost:62807/;https://localhost:62808/;",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },

Note: if I change launchBrowser to false I can successfully start the project, and then open the browser and navigate to the url manually.

Other Note:

Edge is my default browser. When this error occurs, it seems a new empty Edge window is created:

image

To Reproduce

As per above that’s the best I can do at present.

Exceptions (if any)

See screenshots and logs above.

Further technical details

  • ASP.NET Core version: .net 50
  • Include the output of dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.100
 Commit:    5044b93829

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19042
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.100\

Host (useful for support):
  Version: 5.0.0
  Commit:  cf258a14b7

.NET SDKs installed:
  1.1.13 [C:\Program Files\dotnet\sdk]
  2.1.502 [C:\Program Files\dotnet\sdk]
  2.1.503 [C:\Program Files\dotnet\sdk]
  2.1.504 [C:\Program Files\dotnet\sdk]
  2.1.505 [C:\Program Files\dotnet\sdk]
  2.1.507 [C:\Program Files\dotnet\sdk]
  2.1.508 [C:\Program Files\dotnet\sdk]
  2.1.509 [C:\Program Files\dotnet\sdk]
  2.1.511 [C:\Program Files\dotnet\sdk]
  2.1.512 [C:\Program Files\dotnet\sdk]
  2.1.513 [C:\Program Files\dotnet\sdk]
  2.1.514 [C:\Program Files\dotnet\sdk]
  2.1.515 [C:\Program Files\dotnet\sdk]
  2.1.516 [C:\Program Files\dotnet\sdk]
  2.1.519 [C:\Program Files\dotnet\sdk]
  2.1.600 [C:\Program Files\dotnet\sdk]
  2.1.602 [C:\Program Files\dotnet\sdk]
  2.1.800 [C:\Program Files\dotnet\sdk]
  2.2.101 [C:\Program Files\dotnet\sdk]
  3.0.100 [C:\Program Files\dotnet\sdk]
  3.1.102 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.402 [C:\Program Files\dotnet\sdk]
  5.0.100-rc.1.20452.10 [C:\Program Files\dotnet\sdk]
  5.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0-rc.1.20452.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
  • The IDE (VS / VS Code/ VS4Mac) as per above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:25
  • Comments:113 (9 by maintainers)

github_iconTop GitHub Comments

17reactions
andrewsmalekcommented, Mar 8, 2021

I’ve tried all the above solutions and nothing worked for me.

However, Disabling “Script Debugging” seems to fix the issue for me. Update: as mentioned by RNONGFU001, make sure to end the active task for your browser first (chrome, edge…etc.).

image

14reactions
vnbaaijcommented, Jan 5, 2021

What fixes this for me is:

  • Close Visual Studio
  • Delete the “debuggerConfiguration-{guid}.json” file from the “{solution}\.vs\{solutionname}\config\” folder .
  • Start Visual Studio and happy debugging!
Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting ProtocolException runtime error Blazor project
Sometimes when I start the application I get a runtime error 'Failed to launch debug adapter Exception of type Microsoft.VisualStudio.Shared.
Read more >
The debug adapter exited unexpextedly. And then
Failed to launch debug adapter. Additional information may be available in the output window. Exception of type 'Microsoft.VisualStudio.Shared.
Read more >
Visual Studio Error: Failed to Launch Debug Adapter
When debugging a custom low level analyzer, and when attempting to attach a debugger to the Logic 2 software via the instructions here,...
Read more >
Failed to launch debug adapter : r/VisualStudio
The two Visual Studios try to launch as tabs in the SAME Chrome instance. I loaded a random different project from another codebase...
Read more >
Debug ASP.NET Core Blazor WebAssembly
Visual Studio (Windows) timeout. If Visual Studio throws an exception that the debug adapter failed to launch mentioning that the timeout was ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found