编辑并继续使用非常简单的单行方法

时间:2022-09-05 03:17:13

I have very simple class method. Here it is:

我有非常简单的类方法。这里是:

  public string SendDataInHandle(string handleName, string data)
  {
      return _connectionType.SendDataInHandle(handleName, data);
  }

I put a breakpoint on this line and trying to add console.writeline like this

我在这一行上设置了一个断点并试图像这样添加console.writeline

  public string SendDataInHandle(string handleName, string data)
    {
        Console.WriteLine("123");
        return _connectionType.SendDataInHandle(handleName, data);
    }

And got an error:

并得到一个错误:

Error 1 Modifying a 'method' which contains a dynamic invocation will prevent the debug session from continuing while Edit and Continue is enabled. *.cs 248 9 *

错误1修改包含动态调用的“方法”将阻止在启用“编辑和继续”时继续调试会话。 * .cs 248 9 *

What am i doing wrong ? Where is dynamic invocation ? How to fix it ?

我究竟做错了什么 ?动态调用在哪里?怎么解决?

.net 4.5 simple console application with target platform x86

.net 4.5使用目标平台x86的简单控制台应用程序

1 个解决方案

#1


0  

It's possible from this msdn that you "modified" the current executing line by inserting the Console.WriteLine.

从这个msdn可以通过插入Console.WriteLine“修改”当前执行行。

Check out the first bullet here: http://msdn.microsoft.com/en-us/library/ms164927.aspx

查看第一个项目符号:http://msdn.microsoft.com/en-us/library/ms164927.aspx

"Changes to the current statement or any other active statement.

“对当前声明或任何其他有效声明的更改。

Active statements include any statements, in functions on the call stack, that were called to get to the current statement."

活动语句包括调用栈中函数的任何语句,这些语句被调用以获取当前语句。

#1


0  

It's possible from this msdn that you "modified" the current executing line by inserting the Console.WriteLine.

从这个msdn可以通过插入Console.WriteLine“修改”当前执行行。

Check out the first bullet here: http://msdn.microsoft.com/en-us/library/ms164927.aspx

查看第一个项目符号:http://msdn.microsoft.com/en-us/library/ms164927.aspx

"Changes to the current statement or any other active statement.

“对当前声明或任何其他有效声明的更改。

Active statements include any statements, in functions on the call stack, that were called to get to the current statement."

活动语句包括调用栈中函数的任何语句,这些语句被调用以获取当前语句。