在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
当前回答
对我来说,没有一个项目能解决这个问题。我只是在函数中添加了一行新代码,类似于:
int a=0;
通过添加这个,我想我触发了visual studio在原始版本中添加这个功能
其他回答
关闭Visual Studio并重新打开解决方案可以修复这个问题,即它是IDE本身的一个bug(我正在运行VS2010)。
如果有多个Visual Studio实例正在运行,则只需关闭运行有问题的解决方案的实例。
如果您调试的进程包含多个appdomain,并且程序集都被加载到两个域中,其中一个正在加载旧副本(通常是动态加载的插件),断点可能看起来很稳定,但应该命中断点的线程位于旧程序集的appdomain中,并且从未命中。您可以在模块窗口中看到加载了哪些程序集及其路径。
Exit from vs ->删除“。vs”文件夹。->打开VS. ->运行项目。
上述解决方案对我很有效。希望这也能对你有所帮助。
在我的例子中,我忘记在我声明模板函数的头文件中包含“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.