c# - 跨断点时出现编译错误

标签 c# .net visual-studio-debugging visual-studio-2019

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

我收到消息:

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

Picture of error

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

  • 正在清除我的 .vs 文件夹
  • 重新启动 Visual Studio
  • 重启电脑
  • 清理重建
  • 删除所有断点并重新添加
  • 所有建议的答案 here但都没有用。
  • 升级到 16.3.2
  • 修复 Visual Studio

我还能尝试什么?

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

最佳答案

似乎与这个问题有关,他们在 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.

关于c# - 跨断点时出现编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58219423/

相关文章:

c# - Application.Run(窗体)挂起

c# - 控制 .NET BCL 类型在调试器中显示的方式(对 KeyValuePair(TKey, TValue) 感兴趣)

c# - 带有 MonoDevelop 和 C# 的 twitter API

c# - 为什么这个结构是可变的?什么时候可以接受可变结构?

c# - 如何在 Windows 窗体 (C#) 中动态添加组合框并将其绑定(bind)到 sql 数据库中表的列

c# - 为什么 Ping 超时无法正常工作?

c# - AndAlso 之间有几个 Expression<Func<T, bool>> : referenced from scope

c# - ASP.NET 用户验证

c# - Visual Studio 2012 拒绝显示源代码,即使加载了 PDB

c# - 为什么我的断点在 Visual Studio 中重复?