VS2019: C++ : Custom File Debug Edit & Continue is not working with Breakpoints.

Peeyush Chaurasia 0 Reputation points
2024-02-13T11:05:40.5266667+00:00

Following MS link Specifying Custom Build Tools | Microsoft Learn I have integrated custom build tool for our Custom file conversion to CPP, which on regular Project build takes care of conversion from custom file to CPP file and building executable further.

  • Using default C++ debugger only generated executable can be directly debugged from Custom File. Breakpoint, callstack etc. works properly.
  • Only issue is in performing Edit & Continue, with Breakpoints. We have reported this,

VS2019:Edit and Continue not working for custom file generating Cpp, Error: .idg not in synch with .pdb - Microsoft Q&A

  1. Here if Project Property-Compiler-debug setting is “Debug Symbol for Edit & Continue“ /ZI, we get build failure as  

Screenshot 2024-02-13 145010

Error in Output Window: Edit and Continue : error  : The dependency information for 'CustomFile.xyz' in the state (.idb) file(s) '' is out of sync with the Program Database (.pdb) file  

  1. As Debugger has locked .IDB and .PDB files, even programmatically triggering MSBuild is failing with error these files in use.

 

  1. We have also tried to change Project Property-Compiler-debug setting to “Program Database” /Zi, in this case Programmatically triggering MSBuild is succeeding, but Debugger still detects changes and

Screenshot 2024-02-13 145010

Error in Output window Edit and Continue : error  : CustomFile.xyz' in 'CustomFile.exe' was not linked with Edit and Continue enabled. Ensure that /INCREMENTAL linking is enabled, and the /EDITANDCONTINUE directive is not ignored.

---   What we are looking for is there a way, either

---Default Debugger in Edit and Continue trigger custom build commands Or

---Default Debugger allow to ignore and continue using Breakpoints/symbols, We can programmatically trigger build and patch executable with generated object file.  

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,736 questions
Visual Studio Extensions
Visual Studio Extensions
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Extensions: A program or program module that adds functionality to or extends the effectiveness of a program.
219 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
1,000 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2024-02-13T11:05:40.53+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Based on the provided context, it seems that Edit and Continue for C++ projects has some limitations. According to the documentation, Edit and Continue is not supported in the following debugging scenarios:

    • Debugging native apps compiled with /Zo (Enhance Optimized Debugging)
    • Projects that use the VC 120 toolset and the C/C++ /bigobj switch. Edit and Continue with /bigobj is only supported in the VC 140 toolset.
    • Mixed-mode (native/managed) debugging.
    • JavaScript debugging.
    • SQL debugging.
    • Debugging a dump file.
    • Editing code after an unhandled exception, when the Unwind the call stack on unhandled exceptions option is not selected.
    • Debugging an app by using Attach to instead of running the app by choosing Start on the Debug menu.
    • Debugging optimized code.
    • Debugging an old version of your code after a new version failed to build because of build errors.
    • Using a custom compiler (cl.exe) path.

    It is possible that the custom build tool you are using falls under one of these unsupported scenarios, which could be why Edit and Continue is not working properly. Unfortunately, it seems that there is no way to trigger custom build commands from the default debugger in Edit and Continue.

    One possible workaround could be to programmatically trigger MSBuild to build and patch the executable with the generated object file. However, it seems that this approach has also encountered some errors with the debugger detecting changes and giving an Edit and Continue error dialog box.

    Based on the information provided, it is unclear if there is a way to ignore and continue using breakpoints/symbols while programmatically triggering a build. It may be worth exploring other debugging options or reaching out to Microsoft support for further assistance.


    References:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.