3

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

1
  • 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. It's for Edge though, but it works. Commented Apr 28, 2022 at 3:46

4 Answers 4

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

Sign up to request clarification or add additional context in comments.

Comments

2

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'

4 Comments

Also worth totally clearing browser history
Does clearing it 100 times count? 🤡
i am on 17.8.0 VS 2022. i noticed this with a new .NET 7 WASM project. breakpoints are hit when i start the .client project (but then i'm missing the server!) when running the .server project in debug mode, only when auto-starting EDGE breakpoints are hit, not in Firefox or Chrome. WHY? HOW can i fix those browsers?
Little late to the party. It's .NET 9 now. I just ran into similar problem. It seems that only Edge works best for debugging Blazor WASM. I used to develop a Blazor Server project and Firefox worked fine. I just started a Blazor Auto project. The breakpoints only got hit in the first run in Firefox after a fresh build (I guess it's because the first run is in Server mode). While Edge works fine in most situations.
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.

6 Comments

thanks - and wow seems drastic. I can debug new blazor WASM apps fine so I don't think it's a system level issue?!
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.
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
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, did you ever figure it out? I'm on 17.8.6 with .NET 8 and this is happening to me.
|
1

I had a similar issue. Tried almost everything, then I looked at the cs.proj file and noticed this property group

 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugType>full</DebugType> <DebugSymbols>true</DebugSymbols> <WarningLevel>0</WarningLevel> <Optimize>False</Optimize> 

I tried removing it, rebuilding, and ran it again then BOOM debugging worked and the breakpoint was hit. Hopefully this saves someone else some time.

2 Comments

This answer was flagged 8 months ago and because of that I deleted it. However after running into this same problem again I stumbled upon this post and saw my deleted answer. It worked for me again so I am adding it back.
I'll have to try that the next time this aggravating problem arises. It would be nice to know how/why this keeps happening.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.