How do I remedy the “The breakpoint will not curre

2018-12-31 03:14发布

C# desktop application on express edition. Worked then didn't work 5 seconds later.

I tried the following.

  • Ensure debug configuration, debug flag, and full debug info are set on all assemblies.
  • Delete all bin and obj folders and all DLLs related to the project from my entire machine.
  • Recreate projects causing the problem from scratch.
  • Reboot.

I have two WinForms projects in the solution. One of them loads the debug info, one doesn't. They both refer to the assembly I'm trying to get debug info on in exactly the same way in the project file. Any ideas?


I want to add in here, mostly for myself when I come back to review this question, that symbols are not loaded until the assembly is loaded, and the assembly is not loaded until it is needed. If the breakpoint is in a library that is only used in one function in your main assembly, the symbols will not be loaded (and it will show the breakpoint as not being hit) until that function is called.

30条回答
初与友歌
2楼-- · 2018-12-31 03:52

Cross posting this fix from Hans K that I found on the similar thread >> HERE <<:

Right click on solution --> Properties

Look under Common Properties --> Startup Project

Select multiple startup projects

select Start action on the projects you need to debug.

查看更多
皆成旧梦
3楼-- · 2018-12-31 03:54

In my case "Optimize Code" was checked in my project properties. This caused VS to see my assembly as "not my code", and in turn, it did not load symbols for it.

The solution was to uncheck this. Location of Optimize Code checkbox

查看更多
只若初见
4楼-- · 2018-12-31 03:55

I tried everything mentioned above, but nothing worked. [Clean solution, and check for PDB files etc.]

Even publishing the same solution did not resolve the issue.

Then I went to back to what I usually do to resolve (fool this stubborn Visual Studio)

All I did was to make a deliberate change in code and publish the solution. Then I reverted the change and published again.

Voila [PDB files rid of evil spirits].. Not a smart resolution, but this did work.. :-|

查看更多
像晚风撩人
5楼-- · 2018-12-31 03:55

This took me a while tried other options above and for some strange reason debugging stopped working.

Tool -> Options -> Debugging -> General -> (untick) "Require source files to exactly match the original version" option

查看更多
伤终究还是伤i
6楼-- · 2018-12-31 03:55

I was integrating a C# application with a static library using VS10 - which I'm new to. I wrote a managed code dll to interface them. I could set breakpoints everywhere but the static lib. I got the message described above - no symbols have been loaded for this document. I tried many of the suggestions above. I could see that the symbols weren't being loaded. I finally noticed a check box Configuration Debug, Enable unmanaged code debugging. That allowed me to set breakpoints in the static lib functions.

查看更多
看风景的人
7楼-- · 2018-12-31 03:57

First try rebuilding your project by right mouse click the project > Rebuild If that doesn't work, try a clean of the project (right mouse click on the project > clean)

If that didn't work check this:

  1. Right mouse click your project
  2. select [Properties]
  3. select the [Build] tab
  4. make sure [Define DEBUG constant] and [Define TRACE constant] are checked
  5. Click the [Advanced] button at the bottom of the Build tabpage
  6. Make sure that [Debug Info:] is set to [full]
  7. Click [OK] and rebuild the project ;-)

(step 6 generates the .pdb files, these are the debugging symbols)

查看更多
登录 后发表回答