Partilhar via


C# Edit and Continue: error 4053 

Error Message

Modifying a '[method | property | indexer | operator | event | constructor | destructor]' which contains an anonymous method will prevent the debug session from continuing while Edit and Continue is enabled

You tried to modify a method, property, indexer, operator, event, constructor or destructor containing an anonymous method. Edit and Continue does not support this change during debugging.

Consider this code:

class Program

{

   delegate void D();

   static void Main(string[] args)

   {

      D d = delegate { System.Console.WriteLine("D"); };

      System.Console.WriteLine("Main");

   }

}

If you step into Main, then change WriteLine(“Main”) to WriteLine(“Hello”), this error occurs.

To correct this error

  • On the Edit menu, click Undo to undo changes

    -or-

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

See Also

Reference

Supported Code Changes (C#)
Edit and Continue (Visual C#)

Other Resources

Edit and Continue Errors and Warnings (C#)