在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。

这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?


当前回答

这发生在我身上是因为我在解决方案中有其他项目没有构建。 在我卸载那些有问题的项目后(在解决方案资源管理器中右键单击项目->卸载项目),重新构建解决方案并再次运行—断点被击中!

其他回答

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.

我也遇到过这种情况。导致我的问题的条件:

我正在本地运行一个完整的IIS7实例 我正在把我的软件分成不同的项目

我打开以前的版本导致了这个问题(VS提示问我是否想在IIS调试中指向这个实例,我回答'是'),然后打开当前版本(再次响应IIS提示'是'),然后尝试在以前的版本中调试。

为了解决这个问题,我只是关闭并重新打开了之前的预期版本,再次将其断言为调试源。

在我的案例中,问题在于ASP。在项目属性>>Web下未启用NET调试

首先,我尝试从命令行;

从命令行删除临时文件确实有效。

C:\Windows\ Microsoft.NET \ Framework64 \ v4.0.30319 \临时ASP。>rd /s root . NET文件

当我在工具->选项->调试->通用中禁用“启用只是我的代码”选项时

这个问题为我解决了。这是一个WCF应用程序,试图调试一个ashx页面。 http://blogs.msdn.com/b/zainnab/archive/2010/10/25/understanding-just-my-code.aspx

当调试期间或调试会话之间的系统时间发生变化时,可能会发生这种情况,无论是通过编程方式、手动方式还是通过外部程序。