C# Edit and Continue: error 4023 

Error Message

Adding a method body will prevent the debug session from continuing while Edit and Continue is enabled

This error indicates that you tried to add a method body, indexer, property, accessor, operators, constructors, destructors, or event.

Consider the following code:

abstract class Base

{

   protected abstract void Method();

}

class Program : Base

{

   static void Main(string[] args)

   {

      ...

   }

   

   protected override void Method() { }

}

If you step into Main, then remove the semicolon after the declaration of Method in the base class and add {}, this error occurs.

To correct this error

  • Undo the changes, and then continue debugging without the changes.

    —or—

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

See Also

Reference

event (C# Reference)
Indexers (C# Programming Guide)
operator (C# Reference)
Destructors (C# Programming Guide)
Supported Code Changes (C#)
Edit and Continue (Visual C#)

Other Resources

Constructors (C# Programming Guide)
Edit and Continue Errors and Warnings (C#)