在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
当前回答
从Visual Studio 2017 15.3.1到15.3.5,出现了解决此问题的新方法。如果您正在使用EditorConfig,则charset=utf8选项会导致这些症状。VS团队已经复制了这个,并表示他们正在努力。
因此,一个修复方法是注释掉.editorconfig文件中的charset=utf8行。
编辑:这应该在VS 15.5被修复。
其他回答
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.
这也是一个重新保存网页的选项。配置以碰撞其修改时间。
问题是调试信息与程序集不同步。解决方法很简单:
转到你的bin文件夹 删除.pdb文件 重建
应该能成功!
(奇怪的是,不丢弃.pdb文件的重新构建并不总是有效。我可以看到修改的日期正在更新,但仍然在链的某个地方(VS2013调试器,IIS,程序集缓存)没有检测到此更改)
去
工具 选项 调试 一般
取消选中“要求源文件与原始版本完全匹配”
在我将现有文件添加到项目后,它碰巧在Visual Studio 2017上。这招对我很管用:
关闭溶液, 转到SolutionFolder\。vs\SolutionName\v15\sqlite3,删除storage.ide 再次打开解决方案
在尝试调试时,请确保您没有处于发布模式。