Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dazinator opened this issue Nov 24, 2020 · 113 comments
Labels
affected-medium This issue impacts approximately half of our customers area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. External This is an issue in a component not contained in this repository. It is open for tracking purposes. feature-blazor-debugging This issue is related to debugging of Blazor WebAssembly apps feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly investigate severity-major This label is used by an internal tool
Milestone

Comments

@dazinator
Copy link

dazinator commented Nov 24, 2020

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
@dazinator
Copy link
Author

I should also mention that, I have seen a few references to this issue, and apparently it was fixed in RC2 - but for me, this does not appear to be the case :-/

@dazinator
Copy link
Author

Additional note: I found what looks to be an identical issue (all be it with not so much detail) reported on the visual studio developer community site, so I also added some detail to it there (like the above logs) https://developercommunity.visualstudio.com/content/problem/1262285/exception-of-type-microsoftvisualstudiosharedvscod.html

@dazinator
Copy link
Author

dazinator commented Nov 24, 2020

Cause: I found setting my default browser (on windows 10, under default apps) to "Chrome" instead of "Edge", and then restarting VS, fixes this issue.

It seems Chrome is a pre-requisite of debugging - perhaps because I have a blazor wasm project in the solution? I think if this is the case, more should be done to pre-empt this and prompt the user to check their default browser or something similar - in lieu of actually supporting Edge (or other browsers)

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Nov 24, 2020
@mkArtakMSFT
Copy link
Contributor

@dazinator glad that you've been able to solve this.
The Edge browser you have on your machine, is that the new Chromium-based edge or the old one?

@mkArtakMSFT mkArtakMSFT added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Nov 24, 2020
@dazinator
Copy link
Author

@mkArtakMSFT
New chromium based one

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Nov 24, 2020
@qinhuaihe
Copy link

Got the same exception with chrome

@mtorromacco
Copy link

Same exception with Edge (Chromium based)

@javiercn javiercn added the feature-blazor-debugging This issue is related to debugging of Blazor WebAssembly apps label Nov 26, 2020
@javiercn
Copy link
Member

@dazinator thanks for the additional details.

Does this happen in a brand new project too?

@javiercn javiercn added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Nov 26, 2020
@damianog
Copy link

Confirm the isuse with Edge Chromium 87.0.664.47, Chrome 86.0.4240.198, but Firefox 82.03 runs.

@dazinator
Copy link
Author

@javiercn
I havent tested yet with any brand new projects but its impacting multiple seperare existing projects/ repos.
Also my solution of switching default browser to chrome was a red herring - I now get the same exception occurring with chrome. It seemed to work for a while but then get into a state where this error occurs and just keeps occurring. Perhaps some process is not being managed correctly, not sure.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Nov 26, 2020
@javiercn
Copy link
Member

@dazinator You might perhaps missed some migration steps, that's why it's important to check if an out of the box template works.

@dazinator
Copy link
Author

dazinator commented Nov 27, 2020

@javiercn it does happen for new projects also.
This was my experience with a new project:

I started with no browser open, launched from VS (2019 Pro 16.8.2) -> it works.
I hit a startup error which left the browser window open, and VS debug session terminated.
I tried to launch again from VS - I see this error.

The screen shot shows the browser window hanging round from first debug session which launched, but then there was a browser error starting blazor. I stopped VS, and the browser window remained. In the second tab is the second attempt at launching a debug session, a new window opened, then I see the error reported and the debug session terminates, leaving another new orphaned tab. If I close all tabs and start from scratch it works.

image

@javiercn javiercn added investigate and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Nov 27, 2020
@javiercn javiercn added this to the Next sprint planning milestone Nov 27, 2020
@ghost
Copy link

ghost commented Nov 27, 2020

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@Flearz
Copy link

Flearz commented Dec 15, 2020

I have the same problem, Chrome window opening but no blazor app loading.
I am wondering if it might be linked to the fact I am using different SSL certificate from the dev one. (Set with https://improveandrepeat.com/2020/05/how-to-change-the-https-certificate-in-iis-express/ )
Or maybe linked to the fact that I use a specific address (changes made in "hosts" file to match 127.0.0.1)
Hope it will be solved soon :)

@chrisret
Copy link

Had the same problem with Chrome/Edge and netcoreapp3.1 (not 5!). Changing to Firefox worked. It appeared suddenly during work, so I thought my changes in code or the new Resharper feature DPA, which I turned on shortly before, is responsible, but it turned out that deleting the .suo file solved the problem. HTH.

@mreinhart2805
Copy link

Had the same problem with Chrome/Edge and netcoreapp3.1 (not 5!). Changing to Firefox worked. It appeared suddenly during work, so I thought my changes in code or the new Resharper feature DPA, which I turned on shortly before, is responsible, but it turned out that deleting the .suo file solved the problem. HTH.

@chrisret Delete of .suo file helped. I have also updated Resharper.

@hjrb
Copy link

hjrb commented Dec 18, 2020

Same here. VS Enterprise 2019 (16.8.3). WASM Blazor project. Work in FF. Fails in Edge and Chrome. I had VS Code installed with both debug Extensions. Now it is uninstalled. Maybe that causes the issue.

@erikthysell
Copy link

Neither IIS express nor the other one works...

@ghost
Copy link

ghost commented May 9, 2021

Tried all of the above, nothing works, tried a brand new WASM template, it does not work out of the box, it will not stop on any breakpoints I am running:-

Microsoft Visual Studio Community 2019 Version 16.9.4

I have Edge, Chrome and Firefox installed none of them stop on the breakpoints, all fire up the app properly but no breakpoints are hit.

I have tried cleaning the projects, deleting the bin and obj folders from all projects, deleting the .vs folder, I have script debugging off, all projects are set to debug, the app works but debugging is not hitting any breakpoints at all.

@giarico
Copy link

giarico commented May 10, 2021

Same issue for me.

Visual Studio Entrerprise 16.9.4
NET 5
Edge (Chromium) & Chrome

With IISExpress the browser is stuck on the "about:blank" page and after a while I get the following error:
"Failed to launch debug adapter".

I have tried all workarounds without success.

@AlexW68
Copy link

AlexW68 commented May 10, 2021

I am going to install a VM tonight of windows 10 tonight, put just visual studio on in, use the standard template and see if that works.

@AlexW68
Copy link

AlexW68 commented May 10, 2021

I have now installed a completely fresh version of windows 10, updated it, installed visual studio community edition, created an app from the WASM template and it does not hit the breakpoints, this is now 3 PC's and one MAC not debugging ASP.NET projects at all.

Steps to reproduce install all of the above create a new app based on the WASM template, stick a break point on the following line.

forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast");

it loads that data without breaking on the breakpoint.

@SteveSandersonMS
Copy link
Member

@AlexW68 Apologies this has been so problematic.

To help diagnose this, could you try setting the breakpoint on the first line inside the “increment count” method in the Counter.razor file, and see if the breakpoint hits when you click the button?

@AlexW68
Copy link

AlexW68 commented May 11, 2021

Hi Steve,

Thanks for the reply, it hits the breakpoints on a new project new vm, old project on an old computer if I copy the counter.razor component into the project and set a breakpoint.

So that works sometimes I get the following error bubble up through to the browser

Unhandled exception rendering component: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0. System.Text.Json.JsonException: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0. ---> System.Text.Json.JsonReaderException: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0

I can set a breakpoint and hit it in the API function server side that seems to work ok. What I am also not able to do when this seems to happen is try catch blocks round the API calls and capture the error it does not seem to want to bubble the error into the client side WASM for some reason.

I did note (and this maybe something completely different) that in another project I set breakpoints, they hit every now and again, then stop debugging and restart and the breakpoints are then not solid red but a red outlined dot, once you are into that module/component you can click it twice to make it solid red.

Thanks for your help I know you guys are busy, but this is really busted at the moment.

(don't think it matters but all the firewalls are switched off)

@AlexW68
Copy link

AlexW68 commented May 11, 2021

Testing this some more that project has now failed, the counter breakpoint still works, but I am finding that if the breakpoint is set inside the api (server app) the breakpoint may get hit on the client side.

In the past clearing the bin/obj folders has helped with these types of issues, this does not seem to work now.

Also changing the api code to the following seems to make the breakpoints more reliable

var rng = new Random();
WeatherForecast[] wf = Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
return wf;

This way I can see what is being returned before it's passed back to the client.

@tadeutorquato
Copy link

Hi guys,

I tried all the workarounds and the only one that worked for me successfully was to remove .vs from the project folder.

@giarico
Copy link

giarico commented May 13, 2021

Same issue for me.

Visual Studio Entrerprise 16.9.4
NET 5
Edge (Chromium) & Chrome

With IISExpress the browser is stuck on the "about:blank" page and after a while I get the following error:
"Failed to launch debug adapter".

I have tried all workarounds without success.

Just to give some more detail, this is the error i get in "visualstudio-js-debugger.txt" file:
Error: Unable to launch browser: "Could not open ws://localhost:22410/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A59874%2Fdevtools%2Fbrowser%2F17a7e068-58d4-415a-a333-e6de0adb6e99"

@AlexW68
Copy link

AlexW68 commented May 15, 2021

Tried the preview version of Visual Studio problem still exists there too.

Here is a small video, this is a basic windows 10 VM with visual studio preview on it, the https and other options really make no difference to if it's going to work reliably or not, I am happy working with alpha builds and helping working through this problem, if I am guided to test certain things.

https://twitter.com/alexwhitegb/status/1393457907505799169?s=21

@AlexW68
Copy link

AlexW68 commented May 20, 2021

This morning I updated to visual studio preview 4

Microsoft Visual Studio Community 2019 Preview
Version 16.10.0 Preview 4.0

deleted the .vs folder, deleted all the bin and obj folders my project initially only debugged inside the api calls (server side) then the client side stuff just started working after a while, I have not been able to pause on the client side api call line for more than 2 weeks so something has changed.

I have seen a pattern and it's reliable, if you have two api calls on the client side and put breakpoints on both, put a breakpoint on the server side api call, it will not break on the initial client side api call first time but once you have broken on the server side api code and stepped through, once you return to the client the breakpoints work from that point onward, so it seems to need to initialise the debugger server side then the client side works ok.

I had noted in another project that the only components that did not work e.g. breaking on breakpoints were ones that injected the http client, any blazor components without api/http client calls seemed to break on break points ok.

@emamcoder
Copy link

@dazinator thanks for the additional details.

Does this happen in a brand new project too?

Yes, this is with a brand new project too.

@eannelson
Copy link

I get the same thing -- deleting the .vs folder within the solution and restarting Visual Studio 2019 seems to fix it ...eventually. Based on the logs, when this happens the debugger is usually trying to attach to a port that I never specified (even in other recent solutions).

System.TimeoutException: Failed to start the debug proxy within the timeout period of 10 seconds.
at Microsoft.AspNetCore.Builder.DebugProxyLauncher.LaunchAndGetUrl(IServiceProvider serviceProvider)
at Microsoft.AspNetCore.Builder.WebAssemblyNetDebugProxyAppBuilderExtensions.<>c.<b__0_1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 6.5718ms 500 text/plain
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 GET https://localhost/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A64613%2Fdevtools%2Fbrowser%2F9e594754-e6fe-4266-bf05-cdd31c776220
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request.

@JoelW187
Copy link

Just upgraded to VS 16.10.1 and I'm still getting this error frequently when launching a debug session. It happens on both Core (Blazor WebAssembly) projects and older Asp.Net Framework (4.x) projects. I've tried all the usual -- delete .vs folder, delete bin/obj folders, etc. There seems to be no pattern to it in my case.

@danroth27
Copy link
Member

Hi folks. If you hit this "Microsoft Visual Studio Failed to launch debug adapter" due to a ProtocolException when trying to debug a Blazor WebAssembly app, please be sure the use the Visual Studio Send Feedback -> Report a Problem feature to let us know. This will automatically collect the logs that we need to understand why the the debug proxy failed to launch. Thanks for your patience on this one!

@danroth27
Copy link
Member

Since this issue isn't actionable on our side without the corresponding VS logs, I'm going to close this issue and we'll follow up on the various Visual Studio Feedback issues. Hopefully we'll get these issues sorted soon.

@khalimed
Copy link

khalimed commented Jul 5, 2021

Hi folks. If you hit this "Microsoft Visual Studio Failed to launch debug adapter" due to a ProtocolException when trying to debug a Blazor WebAssembly app, please be sure the use the Visual Studio Send Feedback -> Report a Problem feature to let us know. This will automatically collect the logs that we need to understand why the the debug proxy failed to launch. Thanks for your patience on this one!

This error happened many times to me recently and there is no such a button to send the feedback in the error dialog.

@danroth27
Copy link
Member

@mohamedalikhalifi The Send Feedback button should be in the upper right-hand corner of VS:

image

@ErnanMaisels
Copy link

I having the same problem

@ErnanMaisels
Copy link

In my case, it was helpful to clear cached files
image

@FastTracOnline
Copy link

Submitted using Feedback, All requested files and then some. I cannot recommend Blazor to my employer at this time. I will not recommend a product that cannot be debugged.

@walhalla-software-dev
Copy link

walhalla-software-dev commented Aug 24, 2021

I read through the whole postings to figure out what is going on here.
It seems the "only" problem is to automaticly start a browser with the debug button (and see debug outputs in console window).

Workarround (just to go on working :) ) :
In your launchSettings.json set the launchBrowser to false
Start the project and manually open your url in the browser => localhost:5000

Shame... this issue is up over a year now... Also in current version of VS + new Project
It doesn't appear for every user. My friend tested it also and got no issue...

@MS-Hayden
Copy link

I've found that unchecking the proxy server checkbox in LAN settings fixes this. I also check automatic detection.

This particular thing has caused this twice for me... completely out the blue...

image

@dazinator
Copy link
Author

I've found that unchecking the proxy server checkbox in LAN settings fixes this. I also check automatic detection.

This particular thing has caused this twice for me... completely out the blue...

image

@MS-Hayden - do you use fiddler or similar tool for inspecting local network traffic? I beleive I found in the past if you don't stop fiddler properly it can leave that tickbox checked.

@MS-Hayden
Copy link

MS-Hayden commented Sep 2, 2021

@MS-Hayden - do you use fiddler or similar tool for inspecting local network traffic? I beleive I found in the past if you don't stop fiddler properly it can leave that tickbox checked.

Yes I do use Fiddler 4, it seems likely this is the cause...

@ghost ghost locked as resolved and limited conversation to collaborators Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affected-medium This issue impacts approximately half of our customers area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. External This is an issue in a component not contained in this repository. It is open for tracking purposes. feature-blazor-debugging This issue is related to debugging of Blazor WebAssembly apps feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly investigate severity-major This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests