在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
当前回答
正如它所说,“源代码与原始版本不同”。
右键单击解决方案资源管理器中的项目文件夹,并选择Clean。构建项目的新版本,断点将再次工作!
其他回答
在我的例子中,我忘记在我声明模板函数的头文件中包含“stdafx.h”。
在我的例子中,其他建议都不起作用,但是重新克隆我的存储库使这个问题消失了。
This happen often also if you are using a file references to binaries (instead of project references to code in your project), and the compiled binary that you are referencing falls out of sync with the corresponding source code on your machine. This can happen because you downloaded a new version of the binary from source control without the new source code that went with it, or you have a few versions of the binary on your machine and are referencing an old copy, etc. If this is indeed the problem, it's a good reason to use project references as much as it practical.
在Windows 7、Visual Studio Express 2010下,如果已激活选项“为Windows XP SP3使用兼容性模式”,则可能会出现此错误。
我取消了这个选项,它再次完美地工作了。右键单击VS或可执行文件的快捷方式,选择属性,然后选择兼容性。
我发现当断点在不能被打断的行上时发生错误。我没有显示工具提示,是为了直接显示后面没有错误的行。