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

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


当前回答

我遇到了这个问题,这是因为我们的DevOps团队要求Azure云设置。在开发时,只需将其从Web.config中删除。

<httpRuntime maxRequestLength="102400" />

    <!--TODO #5 comment out for IIS Express fcnMode goes with httpRunTime above in other environment just in DEV -->
    <!--fcnMode="Disabled"/>-->

其他回答

在我的例子中,我被分配了大约120kb的base64值给静态类中的静态约束字符串字段。之后出现了这个问题。我尝试了很多解决方案,但问题没有解决,直到我把这个沉重的任务。

我的环境: MS VS Community 2017 版本15.9.16

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

在“解决方案配置”中选择“调试”,而不是“发布”

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.

这也是一个重新保存网页的选项。配置以碰撞其修改时间。

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