Partilhar via


C# Edit and Continue: error 4011 

Error Message

Updating the type of a [return type | property type | event type | parameter type | field type | constraint type ] will prevent the debug session from continuing while Edit and Continue is enabled

This error indicates that you tried to edit a type that cannot be changed while debugging:

  • The return type of a delegate.

  • The return type of a method.

  • The property type.

  • An event type.

  • The parameter type of a method or indexers.

  • The type of a field, fixed size buffer, constant, or event.

  • The type of a constraint (including struct, class, or new).

Consider the following example:

class Program

{

   static void Main()

   ...

}

If you start debugging, then try to change void to int, this error occurs.

To correct this error

  • Choose Undo from the Debug menu to undo the change.

    –or–

  • On the Debug menu, click Stop Debugging, make the edit, then start a new debugging session.

See Also

Reference

delegate (C# Reference)
Methods (C# Programming Guide)
Properties (C# Programming Guide)
event (C# Reference)
Indexers (C# Programming Guide)
Fixed Size Buffers (C# Programming Guide)
Supported Code Changes (C#)
Edit and Continue (Visual C#)

Other Resources

Edit and Continue Errors and Warnings (C#)