5

I am trying to debug my Visual Studio C# Blazor project however whenever I try and set a break point I get the error "The breakpoint will not currently be hit. Unbound breakpoint." or "No symbols have been loaded." I had been able to debug until the latest visual release. I have tried the following:

  • Debug and not Release mode.
  • Cleaning and building the solution.
  • Checking and Unchecking "Enable Just My Code"
  • Double checking my launchSettings.json

If anyone can give me any advice on how to solve this it would be greatly appreciated.

William Sewell
  • 133
  • 1
  • 9
  • Are you 100% sure the line you put a breakpoint in will be executed ? It might be in a stale file that has not been compiled, or optimized by the compiler, so it will never execute. – Arthur Attout Apr 05 '22 at 11:47
  • Thanks for your reply. I have put breakpoints in numerous places that definitely should be hit and are working in the browser. – William Sewell Apr 05 '22 at 11:51
  • This SO question might help: [Blazor WASM doesn't hit breakpoint](https://stackoverflow.com/questions/61469337/blazor-wasm-doesnt-hit-breakpoint) Yet, the problem can have different causes and so it would be best to search SO for related questions before making any changes. – Yogi Apr 05 '22 at 12:14
  • Check you bin folder and see if a pdb file is generated. It may be in the debug folder and you are running from the release folder. The pdb contains the dbug info. – jdweng Apr 05 '22 at 12:16
  • Does this answer your question? [VS 2019 WebAssembly Unbound Breakpoint Not Hit](https://stackoverflow.com/questions/71485790/vs-2019-webassembly-unbound-breakpoint-not-hit) – Brad Work Apr 05 '22 at 12:46
  • Look for the loaded modules. There you can see what dll is actually loaded. Although I have no clue about Blazor, this hopefully helps with this kind of issue. – Clemens Apr 05 '22 at 13:32
  • In my case I have commented `DebugType` property of `PropertyGroups` that I had in the project file(file with .csproj extension). Spent a lot of time and tried so many solutions and this one helped. Find the solution in this comment from the GitHub issue - https://github.com/dotnet/aspnetcore/issues/33731?ysclid=lfh1uvvrkc641130948#issuecomment-867202675. Hope it will safe your time – Allaev Bekzod Mar 20 '23 at 16:50

4 Answers4

6

This was fixed by someone but their answer was removed. Basically what I needed to do was Properties/Build/General and set "Debug Symbols" to "PDB file, portable across platforms."

William Sewell
  • 133
  • 1
  • 9
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 05 '22 at 17:17
  • 1
    This helped immensely! I have a Blazor Project that refers to a .NET Standard 2.0 library (with source) which wasn't binding breakpoints within said library. On changing "Debug Symbols" from "PDB file, current platform" to the suggested "PDB file, portable across platforms" it is now binding breakpoints as expected. – David Cross Jul 12 '22 at 02:20
  • This was my solution, thanks a lot! This answer should bis signed as solution. – Christoph1972 Oct 28 '22 at 18:54
  • EDIT: Firefox is not working, only Chrome an Edge. – Christoph1972 Oct 28 '22 at 19:01
1

For me the issue resolved when I resaved the file where I wanted to put a breakpoint.

Turns out the file was in "UTF-8 with BOM" encoding, doing some minor edits (like adding a blank line at the end) changed the encoding to "UTF-8" and breakpoints started working.

srmrco
  • 116
  • 5
  • 6
1

If you have a multi-project solution, go to Solution > Properties.

Then change from "Single startup project", to "Multiple startup project".

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/34670724) – nighthawk Jul 13 '23 at 22:06
  • @nighthawk this does indeed provide an answer to the question. There are many potential reasons why this error can happen and Luis provided one of the solutions. – Console Aug 02 '23 at 16:01
0

I fixed it by double checking my launchSettings.json. I enabled debugging for the project

  • Answer needs supporting information Your answer could be improved with additional supporting information. Please [edit](https://stackoverflow.com/posts/76236805/edit) to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](https://stackoverflow.com/help/how-to-answer). – moken May 15 '23 at 12:39