Share via


C# Edit and Continue: error 4052

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

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

Consider the following code:

class Program

{

   unsafe static void Main()

   {

      char* p = stackalloc char[256];

      for (int i = 0; i < 256; i+) p[i] = (char)i;

   }

}

If you step into Main, then try to add int a = 10 as the first line in Main, this error occurs.

To correct this error

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

    -or-

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

See Also

Reference

stackalloc (C# Reference)

Supported Code Changes (C#)

Edit and Continue (Visual C#)

Other Resources

Edit and Continue Errors and Warnings (C#)