Limitations of Edit and Continue

Home Page (Debugger)OverviewHow Do I... Topics

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.). There is no limit for functions not currently on the call stack.

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

  • Changes to resource files

  • Changes to code in read-only files

  • Changes to optimized code (code compiled with /O1, /O2, /Og, /Ox, /Ob1, or /Ob2)

  • Changes to exception-handling blocks

  • Changes to data types, including class, structure, union, or enumeration definitions

  • Adding new data types

  • Removal of functions or changes to function prototypes

  • Most changes to global or static code

  • Changes to executables that are copied from another machine and not built locally

If you make one of these changes and then try to apply code changes, an error message appears in the Output window. Changes to data type definitions, changes to function prototypes, and introductions of new data types produce an error message (C1092). If you choose an execution command (Go or Step) that applies code changes, a dialog box appears as well, explaining your options (for example, building or proceeding with the original code).

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 exceed the 64-byte limit on new variables for a function on the call stack. It can also occur if you edit a function that calls the current function. Some changes can affect the current call, so Edit and Continue cannot safely apply the change. Instead, it can do either of two things:

  1. Cancel the Go or Step command, giving you the chance to reverse the change or to stop the debugging session and recompile the program for a clean start.

  2. Finish executing the current call using the original code, but apply the code changes to the modified function when the current call completes.

Which of these options is best depends on your situation. Edit and Continue gives you the choice. If you make unsupported changes to the calling function and choose Go or Step, the following dialog box appears:

At this point, you can choose what you want to do.

To cancel the execution command

  • Click No.

To continue the debugging session, but apply the code changes as soon as possible (when the current call finishes)

  • Click Yes.

If you choose to continue the session, the code changes prevent the debugger from showing you the source for the edited function until the current call finishes.