更新:2007 年 11 月
错误消息
如果启用了“编辑并继续”,修改泛型方法则会阻止调试会话继续进行
此错误指示您试图修改泛型方法。“编辑并继续”不支持对泛型方法体的任何修改。但它支持添加对泛型方法的调用。
考虑下列代码:
static class Utils
{
public static T[] CreateArray<T>(int size)
{
return new T[size];
}
}
class Program
{
static void Main(string[] args)
{
int[] array = Utils.CreateArray<int>(10);
}
}
如果在 CreateArray 中的 return new T[size] 处添加一个断点,然后开始调试应用程序并试图将 size 更改为 size + 1,则会发生此错误。
更正此错误
撤消更改,然后在不进行更改的情况下继续调试。
- 或 -
在“调试”菜单上单击“停止调试”,进行更改,然后启动新的调试会话。