Share via


C# Edit and Continue: error 4012 

Error Message

Updating the initializer of a [feld | enum member] will prevent the debug session from continuing while Edit and Continue is enabled

This error indicates that you tried to edit the initializer of either a field, including const, event, or the initializer of an enum member.

For example, consider the following code:

class Program

{

   enum Color { Red = 1}

   static void Main() { }

}

If you into the application and try to change Red = 1 to Red = 2, this error occurs.

To fix the problem

  • On the Edit menu, click Undo to undo the changes

    -or-

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

See Also

Reference

enum (C# Reference)
event (C# Reference)
Constants (C# Programming Guide)
Supported Code Changes (C#)
Edit and Continue (Visual C#)

Other Resources

Edit and Continue Errors and Warnings (C#)