aspnetcore: Unable to debug Blazor hosted webassembly 3.2.0 from Visual Studio 2019 16.6.2
Describe the bug
I have Visual Studio 2019 16.6.2 installed, along with the .NET Core 3.1.301 SDK and all the necessary Blazor templates.
If I create a brand new Blazor WebAssmbly application, I can run it from Visual Studio by pressing <kbd>Ctrl</kbd>+<kbd>F5</kbd> and it opens a new tab on my active browser window and starts fine.
But when I press <kbd>F5</kbd>, a new, separate browser window is opened instead of a tab in my main browser window (which is a pity), but the page remains at about:blank for a while until an error message appears in Visual Studio:
Failed to launch debug adapter. Additional information may be available in the output window.
Unable to launch browser:
"Could not open wss://localhost:5001/_framework/debug/ws-proxy?browser=wsAFFlocalhostA50821FdevtoolsFbrowserFceed3b95-58ac-470a-b10c-5d139cfd7117": timeout after 60000ms
Whether the Blazor WebAssembly application is “Hosted” or not doesn’t make a difference.
I’ve followed the steps in the Enforce HTTPS in ASP.NET Core, but that made no difference either.
If, while waiting for the about:blank window to crash, I manually open the client side url on a browser tab, the app loads and the debugger breakpoints are hit.
During the short while before it goes on to crash, if I hit <kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>D</kbd> I always get the following error:
Unable to find debuggable browser tab
Could not get a list of browser tabs from http://127.0.0.1:9222/json. Ensure your browser is running with debugging enabled.
Resolution
If you are using Microsoft Edge (80+) for your development, follow these instructions:
Press Win+R and enter the following:
msedge --remote-debugging-port=9222 --user-data-dir="C:\Users\[my_username]\AppData\Local\Temp\blazor-edge-debug" --no-first-run https://localhost:44372/
I get this each and every time, no matter how often I run the command (having closed all browser instances, rebooted, etc)
This happens in both Edge 84 (Edgium) and Chrome.
I should be able to create a new Blazor WebAssembly app and hit <kbd>F5</kbd> on Visual Studio out of the box. What am I missing?
=============== UPDATE ==================
I’ve just tried using “old Edge” (EdgeHtml) and Firefox as the debug browser in Visual Studio, and both work as expected (meaning that the application at least starts up when pressing <kbd>F5</kbd>). The problem apears to be both Chromium-based browsers then…
=============== UPDATE 2 ==================
Removing the IIS Express section from launchSettings.json on the Server project allows VS 2019 to start Kestrel up and that does load the Blazor Wasm app on a new browser window. <kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>D</kbd> still fails with Unable to find debuggable browser tab, though.
To Reproduce
Just create a fresh Blazor WebAssembly from Visual Studio and press <kbd>F5</kbd>
Further technical details
- ASP.NET Core 3.1.3
- Visual Studio 2019 16.6.2
- Windows 10 (1909)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 41 (9 by maintainers)
I hope this helps someone. Whenever I ran my blazor webassembly hosted app in Visual Studio the browser opened but it just stayed on about:blank for ages and never loaded the web page/app. I found that if you open up the browser dev tools (Ctrl + Shift + I) it shoved it along and the page actually loaded and it all worked. This works in both Chrome and Edge (at least for me).
Yes i have the similar issue with the latest .net5 preview 8 using blazor wasm. Strangely., when i create a new project, it works and i can debug the code. Then if i were to stop and start it again. It will have the forever spin in chrome. I open a new chrome or ie edge and it works or if i press f12 to debug the page shows but under both circumstances it cant be debugged. Sometimes, after waiting for a long time, when i debug again, it starts working for that run and then fails on subsequent restart. I deleted the bin and obj folder also to no avail. I am using wasm with pwa and chrome 85. Trying edge as the default project browser doesnt allow me to debug but loads the page.
Hi All, Long time listener, first time caller. A bit disappointing about resolution timeframe, here’s what worked for me… I found this file: debuggerConfiguration-1859ae3b-3952-46c9-8065-7b07286175be.json under …\MyApp.vs\MyApp\config it contains a single line {“chromiumDebuggerPort”:60128} The file was a couple of weeks old, which struck me as odd, anyhow i deleted the file. Then on next run-with-debug a new you-beaut file was created and my debugging came good. My guess is that VS is having trouble exchanging that file, especially when changing Debug properties for the project. FWIW - this is a hosted Blazor web-assembly application
Aside from some esoteric bits and bobs, i am loving Blazor and the VS2019 environment.
Go hard MS.
W.
Thanks for the tip, @RealHustengutzel. Unfortunately, it made no difference in my case either.
had also the same issue. I enabled ScriptDebugging(dropdown at Start debugging) in VisualStudio and now it works fine.
Thanks for contacting us. We’re moving this issue to the
Next sprint planningmilestone for future evaluation / consideration. We will evaluate the request when we will 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.same issue, on F5 the browser window remain blank with the spinning loading forever, the only way to go forward is to open the chrome web tools with F12, but in this way the debugger works only in chrome and no breakpoint are hit in visual studio.
@captainsafia this is a very priority issue, we need to wait until november release to be fixed?? as is the debug is impossible!
Hi, After searching for couple of days, I did the following and it worked like charm: 1.Install IE “Microsoft edge” 2.Use IE “Microsoft edge” as your VS. browser (NOT CHROME) 3.Use your application as server (NOT IIS EXPRESS). Enjoy.
@kollfeldt, thanks for the tip, but unfortunately uninstalling Hyper-V (and restarting) made no difference for me; still having the exact same issue.
SO I can’t debug blazor webassembly web apps and you are saying it isn’t going to be fixed till November?
I have the same issue, finally instead of IIS Express I use the project launchsettings:
I too have a similar issue. F5 opens the browser and it sits spinning on about:blank and if left will timeout as above. Pressing F12 before the timeout to enter the browser developer tools triggers the blazor webassembly app to load but almost without exception no breakpoints are hit.
I’m having a very similar issue, with exactly the same symptoms, but in my case, a new blank wasm project actually works. It’s just my own existing project that I can’t get working. I’ve tried making everything as similar as possible between the two, but it just doesn’t work.
I also get the same error message when trying the <kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>D</kbd>