Getting ProtocolException runtime error Blazor project

5.3k Views Asked by At

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

7

There are 7 best solutions below

0
On

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();
            }
         ...

0
On

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

0
On

Apparently, this is such a big issue, @Matthias my defualt browser was actually set to Google Chrome, and I then set it to Edge. In addition I then set the debug browser to use FireFox @Richard Wrench. On top of all that, I also deleted the obj and bin folders of my project before restarting VS 2019 and rebuilding my project again. This added information is because the problem doesn't have a real fixed solution, so these extra steps may help as they did for me

0
On

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

2
On

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

0
On

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.

0
On

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