Blazor WASM Breakpoints not being hit

Viewed 385

I'm following the TimCorey 'TimCoRetailManager' course. It contains the Counter.Razor page (same one you see in the project template) in the WASM project.

I've put breakpoints in the @code and they are never hit.

I've tried this delay: Can't hit breakpoint in program.main Blazor Client wasm

I've tried deleting the .vs solution folder, reloading the solution and rebooting as recommended elsewhere.

None of my folders have a # in the name.

If I create a new WASM project it hits the breakpoints fine.

How can I get them working? Thx.

enter image description here

2 Answers

I ran into this issue today. The solution for me was to use dotnet-core-uninstall to remove all .NET SDKs and runtimes, reboot my PC, and then reinstall .NET 6.0.

Through basic testing I was able to determine that I could debug a Blazor WASM app created with dotnet new blazorwasm when targeting .NET 5.0, but not when targeting .NET 6.0. Both apps were completely boilerplate, and I added a breakpoint on the same line you did in Counter.razor.

Solutions I tried included repairing the .NET 6.0 SDK, switching between Edge and Chrome, and reinstalling Visual Studio, but still couldn't get it to work on .NET 6.0 until I wiped out all the SDKs and runtimes and started fresh.

Just got this error at it's like David Fuchs said. I had updated package in a Blazor Client project from .NET Core 5 to 6 but left a few others still pointing to 5. This caused this issue of the breakpoint. After I updated and consolidate all packages to 6 the Breakpoints were triggered again.

Package I updated to .net 6 - Microsoft.AspNetCore.Components.WebAssembly.DevServer Package still in version 5 - Microsoft.AspNetCore.Components.WebAssembly

Related