Search code examples
c#asp.net-coreblazorvisual-studio-2019blazor-webassembly

The breakpoints aren't hit in a Blazor Webassembly project, ASP.NET Core 3.1,


The breakpoints aren't hit in a ASP.NET Core 3.1, Blazor Webassembly project.

I have a solution with a single Blazor Webassembly project which I run locally.

When placing a breakpoint in a .cs file it says:

"The breakpoint will not currently be hit. A copy of Startup.cs was found in blazor-devserver.dll, but the current source code is different from the version built into blazor-devserver.dll.

To allow this breakpoint to be hit, click the 'Settings...' button that appears, then click 'Location', 'Allow the source code to be different from the original.' ..."

This seems strange to me because I haven't deployed it, I just press F5 in Visual Studio so I don't see how the code can be different.

When the breakpoint is placed in a .razor file it says:

"The breakpoint will not currently be hit. No symbols have been loaded for this document"

In the modules window, symbols have been loaded for all the entries.

It worked fine until recently. The only thing I did was install Microsoft Code Analysis 2019 (I removed it again).


Solution

  • Blazor Webassembly is still in preview stage hence you cannot debug the cs file directly. Debugging is supported via Chrome only. The details are documented here.