Limitations of Edit and Continue

Edit and Continue places a limit of 64 bytes on the total size of the new variables you can add to an active function. (An active function is any function on the call stack — the current function or one of its callers.) If you exceed this limit, the code changes will be applied the next time the function is called. There is no new-variable limit for functions not currently on the call stack.

Edit and Continue does not handle some types of code changes. The following changes cannot be applied during the debugging session:

If you make one of these changes and then try to apply code changes or use an execution command, an error message appears in the Output window. Changes to data type definitions and changes to function prototypes produce a compiler error message (C1092).

In some cases, Edit and Continue cannot apply code changes to the executable immediately, but may be able to apply the code changes later if you continue debugging. This occurs if you edit a function that calls the current function or if you add more than 64 bytes of new variables to a function on the call stack. When this happens, the original code continues to execute until the function exits and is called again. Edit and Continue updates the call at that time. Until the call exits, the source window shows the original code in gray. Because this code has been superceded by code changes, it is outdated or stale. You cannot edit stale code. The debugger warns you about stale code, by default. You can turn the warning off, if you prefer.

To enable/disable the stale code warning

  1. From the Tools Menu, click Options.
  2. In the Options dialog box, select the Debugging folder.
  3. In the Edit and Continue group, select or clear the Warn me about stale code check box.
  4. Click OK.

    Tip   You can change the color that source windows use to display stale code.

To change the color of stale code

  1. From the Tools menu, choose Options.
  2. In the Options dialog box, open the Environments folder and choose Fonts and Colors.
  3. In the Show settings for box, choose Text Editor.
  4. In the Display items box, choose Stale Code.
  5. In the Item foreground box, choose any color.
  6. Click OK.