Search code examples
visual-studioc++17c++-clivisual-studio-debugging

On Visual Studio 2019, how to debug pure C++ and CLI C++ in a C++ Debug program?


I want to debug a C++ MFC/CLI program developped on Visual Studio 2019.

Until now, I can debug C++ native (MFC) code.

DebugType in Debug panel is set to Auto.

All breakpoints in C++/CLI modules are flagged as inactive (a red circle with an interrogation character in a yellow triangle).

After having changed DebugType from Auto to 'Mixed (.Net Framework), Visual Studio, when starting a debug session, is displaying following warning box.

enter image description here

But my build is in DEBUG mode !

What is happening ?

What must I do to debug pure C++ AND CLI C++ code ?

PS: I have also tried to debug in only C++/CLI code, but Visual Studio 2019 is displaying same message !


Solution

  • On Visual Studio 2019, how to debug pure C++ and CLI C++ in a C++ Debug program?

    Since I do not have your project and cannot troubleshoot the issue quickly unless you provide a sample.

    You can try the following suggestions:

    Suggestions

    1) try to reset all settings by Tools-->Import and Export Settings-->Reset All Settings

    2) disable any third party extensions under Extensions-->Manage Extensions in case one of them causes the behavior.

    3) check Use Managed Compatibility Mode option, Enable .NET Framework source stepping option and Suppress JIT optimization on module load (Managed only) option under Tools-->Options-->Debugging-->General.

    4) close VS, delete .vs hidden folder, Debug folder from the solution folder and also Debug folder in the project folder. Then restart your project to test again.