Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting ProtocolException runtime error Blazor project

I'm developing a simple Blazor ASP.NET CORE Web Assembly project with Visual Studio Professional 2019 version 16.8.1 (the exception also happens in version 16.8.0).

Sometimes when I start the application I get a runtime error 'Failed to launch debug adapter Exception of type Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.ProtocolException and the project won't start in the browser.

The browser the application is starting with is the new Microsoft Edge.

The message can be seen below:

enter image description here

like image 581
Richard Wrench Avatar asked Sep 02 '20 15:09

Richard Wrench


5 Answers

Two possible workarounds that both independently worked for me:

I was seeing this error when Edge was set to my default browser on windows 10. Setting it back to Chrome and restarting VS allowed debugging to work again.

Uncheck the "Enable JavaScript debugging for ASP.NET (Chrome, Edge and IE)" in "Tools > Options > Debugging > General" works for me.

source: developercommunity.visualstudio.com

like image 71
Matthias Avatar answered Oct 23 '22 22:10

Matthias


As Richard Wrench mentioned - I switched over to debug using Firefox as well. I was using Chrome. The 'Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.ProtocolException' seems to have disappeared for me. Try it.

like image 37
Richard Galambos Avatar answered Oct 23 '22 21:10

Richard Galambos


For me deleting .vs folder and rebuild did the trick.

like image 4
Jakub Avatar answered Oct 23 '22 22:10

Jakub


The uncheck JavaScript debugging for ASP.NET did not work for me but switching to Canary works

like image 1
user1029883 Avatar answered Oct 23 '22 22:10

user1029883


Check if in the Configure method of the Startup.cs class in the Server Side there is the line app.UseWebAssemblyDebugging(). This worked for me.

public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerManager logger)
        {
            if (env.IsDevelopment())
            {
                app.UseWebAssemblyDebugging();
            }
         ...

like image 1
MrVizz Avatar answered Oct 23 '22 22:10

MrVizz