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:41

Just Check whether your solution is in Release Mode.

查看更多
忆尘夕之涩
3楼-- · 2018-12-31 03:42

The selected answer led me to fix my problem. But I need to do a few things more:

Even with "Debug" selected in the dropdown:

enter image description here

And in the project Properties > Build:

enter image description here

The Visual Studio was not loading symbols to a specific project. So in that dropdown I select "Configuration Manager" and saw that the settings to my web project was incorrect:

enter image description here

enter image description here

Then I set that to "Debug" and it started to generate the .pdb file. BUT I need to manually copy the PDB and DLL and put in the folder that VS was looking (here is where the selected answer helped me):

enter image description here

查看更多
其实,你不懂
4楼-- · 2018-12-31 03:42

For an ASP.Net application, check the properties of the site, ASP.NET tab. Ensure that the correct ASP.NET version is selected.

查看更多
柔情千种
5楼-- · 2018-12-31 03:42

I know I'm years late, but I thought I'd done something wrong and followed the above steps then I realised I'd set the solution configuration to 'Release' by mistake :)

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

Project Properties (then select your build config) > Build Tab > Advanced... > Debug Info (dropdown)

Set to 'all' or 'pdb-only' then rebuild

查看更多
呛了眼睛熬了心
7楼-- · 2018-12-31 03:46

this happened to me after copy paste another webservice asmx file into an existing webservice, resulting in the same error when trying to debug the recently added service, to be able to debug I had to start without debug, then attach to the process. its weird but its the only way i found to be able to debug.

查看更多
登录 后发表回答