跨断点时出现编译错误

Compilation errors when stepping over breakpoints

每当遇到断点并尝试跨过或进入断点时,我就开始遇到奇怪的错误。

我收到消息:

Edits were made which cannot be compiled. Execution cannot continue until the compile errors are fixed.

项目编译得很好,当我没有遇到任何断点时不会发生这种情况。我正在使用 Visual Studio 2019、16.3.1,这发生在我所有的解决方案中,而不仅仅是一个。我尝试了以下但没有任何效果:

我还能尝试什么?

更新: 我听从了@HansPassant 的建议并禁用了“编辑并继续”,这解决了最紧迫的问题,但它似乎是一个 hacky 解决方法。

似乎与这个问题有关,他们在 16.4 中有一个预览修复 https://developercommunity.visualstudio.com/content/problem/705494/without-any-changes-to-source-files-edits-were-mad.html?childToView=767405#comment-767405

Hi everyone, we are sorry about your experience with Edit and Continue. Yes, we were aware of the issue. Unfortunately, there are different issues that share the same symptom. We are working towards fixing all of them, it might just take some time until we are able to actually track all of them down.

The fix for this particular issue will only be available at 16.4 Preview 3+; - If you want more details on the fix, you can check it out on Roslyn: https://github.com/dotnet/roslyn/pull/38905

We suspect this will address the most common issues found in Edit and Continue, e.g. the one reported in this ticket. We will let you know when it's available for download by updating this same ticket.