2

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

niico
  • 11,206
  • 23
  • 78
  • 161
  • 1
    I had a similar problem. Make sure you are on the latest patch release of the SDK 6.0.202. If you want to have a look at working config, see [my answer here](https://stackoverflow.com/a/72037574). It's for Edge though, but it works. – lonix Apr 28 '22 at 03:46

3 Answers3

2

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

Rui Eloi
  • 36
  • 4
1

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.

David Fuchs
  • 163
  • 1
  • 6
  • thanks - and wow seems drastic. I can debug new blazor WASM apps fine so I don't think it's a system level issue?! – niico Jan 14 '22 at 03:45
  • 1
    Try comparing the .csproj files between your working and non-working project - I have a feeling they'll be targeting different .NET versions. I honestly don't know what is causing the problem, but I'm pretty sure it's a problem with the .NET runtime/SDK installation. – David Fuchs Jan 14 '22 at 05:33
  • pretty extreme, but have no choice. WASM breakpoints had been hit just fine, then, suddenly not! Another visual studio 2022 update bug. Time to reinstall everything... AGAIN – MC9000 Nov 17 '22 at 02:03
  • Unfortunately, uninstalling everything, SDKs and VS (100% of it) had no effect. I believe VS 2022 17.3.2 and up has a bug in it (since it does not work in new projects nor after complete reinstall) – MC9000 Nov 17 '22 at 05:38
0

I ran into the same issue today and the solution for me was to change the Web Browser to Edge.screenshot of VS UI changing the Web Browser to Edge: from the dropdown near the 'start debugging' button, select 'Web Browser' and then 'Microsoft Edge'

Dani
  • 519
  • 5
  • 8