Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 Edit and Continue not working

With VS2013 Pro I am not able to use "Edit and Continue" when debugging an MFC program. I created a new MFC project to test.

OS is Windows 7 64-bit and I'm running Visual Studio 2013 12.0.30110.00 Update1.

Under Tools->Options->Debugging->Edit and Continue I have Enable Edit and Continue checked. I have unchecked it and checked it, but whenever I modify the code while debugging I get the following message:

The source file has changed. It no longer matches the version of the file used to build the application being debugged.

Basically I haven't changed any settings except for the tab sizes and I've set the keyboard mapping scheme to VC6.

What setting am I missing to enable edit and continue?

like image 276
MaxiFlash Avatar asked Mar 11 '14 15:03

MaxiFlash


People also ask

How edit and continue works?

Edit and Continue is a time-saving feature that enables you to make changes to your source code while your program is in break mode. When you resume execution of the program by choosing an execution command like Continue or Step, Edit and Continue automatically applies the code changes with some limitations.

How do I turn off break mode in Visual Studio?

There is a free extension to resolve this issue: Disable No Source Available Tab available for from the VS Market Place. This small extension will prevent the tool window with title "No Source Available" from appearing in Visual Studio, and preserve the focus on the currently active tab.

How do I enable debugging in Visual Studio?

In the Visual Studio toolbar, make sure the configuration is set to Debug. To start debugging, select the profile name in the toolbar, such as <project profile name>, IIS Express, or <IIS profile name> in the toolbar, select Start Debugging from the Debug menu, or press F5.


4 Answers

Edit and Continue is disabled for native code by default. To enable:

  1. On the Tools menu, click Options.
  2. In the Options dialog box, open the Debugging node, and select the Edit and Continue category.
  3. In the Native-only options group, select Enable native Edit and Continue

Edit: Steps to test native Edit and Continue is working:

  1. Start VS 2013
  2. Create a new MFC project:
    • FILE->New Project->MFC Application->OK.
    • Select Finish on the MFC Application Wizard.
  3. Build and start debugging:
    • BUILD->Build Solution
    • DEBUG->Start Debugging
  4. Break into the program:
    • DEBUG->Break all
  5. Make a code change:
    • Open OutputWnd.cpp and find COutputWnd::OnSize (Line 80)
    • Insert this line at the start of the function: cx = cx / 2;
  6. Continue execution:
    • DEBUG->Continue
  7. Resize the application window to see the effect of the code change on the Output pane at the bottom. Its width should be half the required size.
like image 195
CarlJohnson Avatar answered Dec 20 '22 23:12

CarlJohnson


Edit and continue is also a Setting for each project.

  1. It must be set in the compiler options under C++ -> General -> Debug Information Format: "Program Database for Edit And Continue (/ZI)"
  2. Also the linker settings must be changed. The linker has to use incremental linking. Linker -> General -> Enable Incremental Linking = Yes or (for VC 2012 users) C++ -> All Options -> Enable Function-Level Linking = Yes (/Gy)

For more information read the MSDN.

like image 42
xMRi Avatar answered Dec 21 '22 00:12

xMRi


The last hint helped, but we had to

set "Image Has Safe exception handlers" = NO(/SAFESEH:NO)

in all projects of our solution!

like image 45
Christian Beilken Avatar answered Dec 20 '22 23:12

Christian Beilken


I did all steps described above, but nothing helps (thanks all for it).

My solution was:

Project -> Properties -> Linker -> Advanced:

set

"Image Has Safe exception handlers" = NO(/SAFESEH:NO)

Apply, Ok, and Rebuild project.

Hope it helps.

like image 23
JEX725 Avatar answered Dec 21 '22 00:12

JEX725