c# - .NET Core 应用程序调试错误 : "Unable to set the next statement. This file does not exactly match the original version."

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

在 VS 2017 中调试 .NET Core 控制台应用程序时,我无法进行编辑然后设置下一条语句。它给了我标题中提到的错误:

enter image description here

比如我在注释处设置断点,然后调试,修改断点正上方第一行的字符串,会报错:

static void Main(string[] args)
{
    string x = "foo"; // modify this after debug breaks.
    string y = "bar"; // breakpoint here
}

注意这在 .NET Framework 控制台应用程序中按预期工作。

当我用谷歌搜索这个 OP 的标题时,我得到的结果为零,即使我将错误消息中的两个句子分成单独的引号字符串。当我在没有引号的情况下进行谷歌搜索时,我会得到一些没有提供答案的结果。例如,this one相似之处在于它以“无法设置下一条语句”开头,但其余部分不同。 This one也很相似,但在第一句话之后又有所不同。

这是什么原因造成的?

最佳答案

我有完全相同的错误信息。我不知道它为什么有效,但我通过以下方式解决了它:

  1. 检查 Options->Debugging->General->Use the legacy C# and VB expression evaluators
  2. 运行调试 session (然后我可以在其中编辑并继续)。

再次取消选中标志后,一切仍然有效。

关于c# - .NET Core 应用程序调试错误 : "Unable to set the next statement. This file does not exactly match the original version.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53378442/

相关文章:

c# - 另一个进程正在使用文件 .NET

visual-studio - 如何在 Visual Studio 中使用 IntelliCode?

visual-studio - VS2010 (Express) 调试器在控制台应用程序中捕获 Ctrl+C

c# - 根据重量和值(value)将元素存储在 3 辆卡车中的遗传算法

c# - SignalR 和类型化对象

c# - 图像 split 成 9 block

c# - 比较 SQL 和 C# 中的 DateTime 空值

c# - 将 EF 模型从 SSCE 4.0 切换到 SQL Server 2008 R2

c# - 在 .net 中读取大型 XML 文档

.net - System.ServiceModel.Web.dll 在哪里?