c# - 编辑并继续在某个时候退出为我工作

标签 c# visual-studio-2008 debugging

<分区>

我用 C#(使用 VS2008)开发应用程序已经有一段时间了,大约一周前,“编辑并继续”对我来说已经停止工作了。我可以在调试时编辑代码,但现在我对代码所做的任何小改动都会迫使我停止项目并重新启动它。我收到的消息是这样的:

修改包含 lambda 表达式的“方法”将阻止调试 session 在启用编辑和继续时继续。

奇怪的是,发生这种情况时我什至没有使用 lambda。上周在 Debug模式下修改相同的代码块让我继续没有问题。我在 Internet 上进行了各种搜索,以找出我可以做些什么来导致这种行为改变。我在 Web 上可以找到的唯一帮助与调试 ASP.NET Web 项目直接相关。但是,我的这部分解决方案是一个 Windows 窗体项目。

可能是什么问题?有没有办法来解决这个问题?如果有任何帮助,我将不胜感激。

最佳答案

只是一个猜测,但也许您正在调试的方法包含从 lambda 捕获的类型。

以下引自 here .

... EnC [EditAndContinue] can modify IL, but not types--that is, it can't add fields or methods to a type, remove a type, or create a new one. Lambda expressions that capture local variables can result in the creation of hidden types under the hood. Modifying a method containing a lambda expression could change the locals that are captured, which would require changing the hidden type. The same limitation has existed with anonymous methods since C# 2.0 and VS 2005.

关于c# - 编辑并继续在某个时候退出为我工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/937049/

相关文章:

c# - 比较元组列表的最佳方法

c# - 如何在 Visual Studio 中为索引器 "go to definition"设置 `this[]`

c# - 在 C# 窗口窗体上保存/加载输入?

c - 多维数组和传输缓冲区

c++ - 在 Windows 中调试堆栈溢出?

debugging - 在打包的 EXE 文件中查找 OEP

c# - 理解C#的类型转换

c# - 在 WCF 中调试自定义服务主机工厂

c# - 以精益方式编写微服务(Windows 服务)部署脚本

c# - JQuery AJAX,错误状态代码 : 200, 状态文本:parserorro |好的