Richard Wrench
Richard Wrench

Reputation: 301

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

Upvotes: 20

Views: 5366

Answers (7)

MrVizz
MrVizz

Reputation: 11

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

Upvotes: 1

Jakub
Jakub

Reputation: 159

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

Upvotes: 5

user15003230
user15003230

Reputation: 11

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

Upvotes: 0

kudzanayi
kudzanayi

Reputation: 91

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

Upvotes: -1

Joe Robe
Joe Robe

Reputation: 1195

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

Upvotes: 1

Richard Galambos
Richard Galambos

Reputation: 41

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.

Upvotes: 4

Matthias
Matthias

Reputation: 280

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

Upvotes: 10

Related Questions