在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
当前回答
I suffered from this recently, and in my case I traced the problem back to something I was doing when testing: changing the system time. I'm not suggesting this is the case for everyone, but thought I'd mention it since it hasn't been mentioned already. It appears if you start moving the clock around between debug builds then it can get very confused about what order various files have been created it - I can only assume it is using file modified dates to determine if the source code is valid or not, and which binaries it needs to recompile.
这也是一个重新保存网页的选项。配置以碰撞其修改时间。
其他回答
对于一个类似的问题,我做了如下处理:
取消选中Debug -> option -> General菜单中的“Enable Just My Code”选项
如果您在调试构建配置中未选中DLL项目,那么您的新代码将永远无法构建!
转到构建—>配置管理器…(在VS2010中),并检查您正在尝试调试的代码的项目是否为当前构建配置进行了检查。
去
工具 选项 调试 一般
取消选中“要求源文件与原始版本完全匹配”
在我的例子中,我忘记在我声明模板函数的头文件中包含“stdafx.h”。
有时您只需要将解决方案配置从“发布”更改为“调试”。