在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
当前回答
在“解决方案配置”中选择“调试”,而不是“发布”
其他回答
也许dll是从GAC加载的。
您可以从gac卸载dll,需要管理员权限。
gacutil -u YourDll
关闭Visual Studio并重新打开解决方案可以修复这个问题,即它是IDE本身的一个bug(我正在运行VS2010)。
如果有多个Visual Studio实例正在运行,则只需关闭运行有问题的解决方案的实例。
对我有用的是将解决方案平台从x86改为Any CPU。在更改为Any后,我设置了一个停止地址,运行网站,打开页面,点击按钮,它就停止了。我关闭了网站,改回x86并成功地执行了相同的顺序。
去
工具 选项 调试 一般
取消选中“要求源文件与原始版本完全匹配”
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.