Why do my breakpoints duplicate in Visual Studio?

帅比萌擦擦* 提交于 2019-12-09 02:51:29

问题


I recently started having problems with breakpoints in Visual Studio 2010. When I set a breakpoint and then start debugging, another breakpoint appears on some other line nearby. The screenshots below shows the editor after I set a breakpoint, as well as the breakpoints window:

As soon as I start debugging, the breakpoint duplicates, as seen in the following screenshots:

Why is this happening and how can I stop it?


回答1:


It looks like there is a child breakpoint set up, as described in the following MSDN articles: http://msdn.microsoft.com/en-us/library/b98cwcyw.aspx (Link dead, see Child breakpoints VS 2010)
http://msdn.microsoft.com/en-us/library/02ckd1z7%28VS.71%29.aspx#vctskbreakpointswindowchildbreakpoints

Here is a similar question on StackOverflow, for which one of the answers contains a macro to remove child breakpoints. Perhaps that might work for you? Disable/remove child Breakpoints?

Alternatively, deleting the parent breakpoint (which will also remove the children) and re-creating it might help to resolve the problem.




回答2:


I suspect it is because of mismatched newline endings. I had similar issue - multiple lines were marked as breakpoint location (say, 10 lines). Later I found it was because of only \n or \r present, instead of CRLF sequence.

Use Save-As, select Save With Encoding.. option under Save button in SaveAs dialog box.




回答3:


I had the same problem in VS 2008 and I resolved by getting rid of the duplicated .dll files in the compiling / debugging folders. Please refer to my full response here: https://stackoverflow.com/a/50063517/3603386




回答4:


Do you use F10 (step over) when debugging?

F9 is the shortcut to add/remove a breakpoint, you may be inadvertently hitting that.



来源:https://stackoverflow.com/questions/9130749/why-do-my-breakpoints-duplicate-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!