Supported Code Changes (C++) - Visual Studio (Windows) (original) (raw)

Edit and Continue for C++ projects handles most types of code changes. However, some changes cannot be applied during program execution. To apply these changes, you must stop execution and build a fresh version of the code.

See Edit and Continue (C++) for information about working with Edit and Continue for C++ in Visual Studio.

Requirements

Build settings (Project > Properties):

  1. C/C++ > General > Debug Information Format: Program Database for Edit and Continue (/ZI)
  2. Linker > General > Enable Incremental Linking: Yes (/INCREMENTAL)
    Any incompatible linker settings (such as /SAFESEH, or /OPT:...) should cause warning LNK4075 during build.
    Example: LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification

Debugger settings (Debug > Options > General):

Unsupported changes

The following C/C++ changes cannot be applied during a debugging session. If you make any of these changes and then try to apply code changes, an error or warning message appears in the Output window.

Unsupported scenarios

Edit and Continue for C/C++ is unavailable in the following debugging scenarios:

Linking limitations

Linker options that disable Edit and Continue

The following linker options disable Edit and Continue:

Auto relinking limitations

By default, Edit and Continue relinks your program at the end of a debugging session to create an up-to-date executable.

Edit and Continue cannot relink your program if you are debugging it from a location other than the original build location. A message tells you that you need to rebuild manually.

Edit and Continue does not rebuild static libraries. If you make changes to a static library using Edit and Continue, you need to manually rebuild the library and relink apps using it.

Edit and Continue does not invoke custom build steps. If your program uses custom build steps, you might want to rebuild manually so that custom build steps can be invoked. In that case, you can disable relinking after Edit and Continue to ensure that you are prompted to manually rebuild.

To disable relinking after Edit and Continue

  1. On the Debug menu, choose Options and Settings.
  2. In the Options dialog box, under the Debugging node, and select the Edit and Continue node.
  3. Clear the Relink code changes after debugging check box.

By default, Edit and Continue loads and processes precompiled headers in the background to speed up processing of code changes. Loading precompiled headers requires allocation of physical memory, which can be a problem if you are compiling on a machine with limited RAM. You can determine if this might be a problem by using the Windows Task Manager to determine the amount of available physical memory while you are debugging. If this amount is greater than the size of your precompiled headers, Edit and Continue should have no problem. If the amount is less than the size of your precompiled headers, you can prevent Edit and Continue from loading precompiled headers in the background.

To disable background loading of precompiled headers for Edit and Continue

  1. On the Debug menu, choose Options and Settings.
  2. In the Options dialog box, under the Debugging node, and select the Edit and Continue node.
  3. Clear the Allow Precompiling check box.

IDL attribute limitations

Edit and Continue does not regenerate interface definition language (IDL) files. Therefore, changes to IDL attributes will not be reflected while you are debugging. To see the result of changes to IDL attributes, you must stop debugging and rebuild your app. Edit and Continue does not generate an error or warning if IDL attributes have changed. For more information, see IDL Attributes.

Diagnosing issues

If your scenario does not fit any of the conditions mentioned above, you can gather further details by setting the following DWORD registry value:

  1. Open a Developer Command Prompt.
  2. Run the following command:
    VsRegEdit.exe set “C:\Program Files\Microsoft Visual Studio\[Version]\[YOUR EDITION]” HKCU Debugger NativeEncDiagnosticLoggingLevel DWORD 1
    VsRegEdit.exe set “C:\Program Files (x86)\Microsoft Visual Studio\[Version]\[YOUR EDITION]” HKCU Debugger NativeEncDiagnosticLoggingLevel DWORD 1

Setting this value at the start of a debug session causes the various components of Edit and Continue to spew verbose logging to the Output Window > Debug pane.