How to Fix Mixed-Mode Debugging Not Hitting Native Breakpoints in C++/CLI and .NET 10
Understanding the Challenge of .NET 10 Mixed-Mode Debugging
Transitioning an enterprise application from .NET Framework to modern .NET (like .NET 10) brings incredible performance gains, but it also changes how the Visual Studio debugging engine operates. If you are running a native C++ MFC application that communicates with a .NET 10 library via a C++/CLI bridge, you might find that setting your debugger to "Mixed (.NET Core)" only hits breakpoints in C#, completely ignoring your native C++ breakpoints.
This happens because the debugging engine for .NET Core/5+ (CoreCLR) handles mixed-mode transitions differently than the legacy .NET Framework CLR. Let's look at the proven steps to resolve this and get your native and managed breakpoints working simultaneously.
Step 1: Configure the Startup Project's Debugger Settings
The most common culprit is that the startup project (your native MFC EXE) is not explicitly instructing Visual Studio to launch the modern .NET Core mixed debugger. Ensure these properties are set:
- Right-click your MFC Host Project and select Properties.
- Navigate to Configuration Properties > Debugging.
- Set the Debugger Type to Mixed (.NET Core) (do not choose 'Mixed' or 'Auto', as they may default to the legacy framework engine).
Step 2: Align Architecture (Platform Targets)
.NET Core and .NET 10 do not support the same loose architectural mixing that .NET Framework did. If your MFC app is 64-bit, every single component must be strictly 64-bit:
- MFC App: x64
- C++/CLI Bridge: x64
- C# .NET 10 Library: x64 (Avoid 'Any CPU' if it resolves to x86 at runtime).
Step 3: Disable "Just My Code"
Visual Studio's "Just My Code" feature can prevent the debugger from stepping into native runtime boundaries when initiated from a managed context, or vice versa.
- Go to Tools > Options > Debugging > General.
- Uncheck Enable Just My Code.
Step 4: Verify C++/CLI Compilation Flags
Ensure your C++/CLI bridge is compiled with the correct CLR support flag for modern .NET. Legacy /clr is for .NET Framework. For .NET 10, you must use:
<!-- Inside your C++/CLI .vcxproj file -->
<CLRSupport>NetCore</CLRSupport>Or in the IDE: Configuration Properties > Advanced > Common Language Runtime Support set to NetCore Common Language Runtime Support (/clr:netcore).
Step 5: Force Symbol Loading for Native Modules
If the debugger is running but breakpoints show the "symbols not loaded" warning (empty circle), you need to verify where the PDBs are being loaded from:
- While debugging, go to Debug > Windows > Modules.
- Find your MFC EXE and C++/CLI DLL in the list.
- Check the "Symbol Status" column. If symbols are not loaded, right-click and choose Load Symbols, then point to your debug directory.
- Ensure that the linker output settings for both native projects are generating full debug info (
/DEBUGand/Zior/ZI).
Alternative: Attaching to the Process Correctly
If launching directly from Visual Studio continues to fail, you can use the "Attach to Process" method, but you must manually select the correct debugging engines:
- Go to Debug > Attach to Process.
- Click Select... next to the "Attach to:" field.
- Check both Native and Managed (.NET Core). *Note: Do not select "Managed (v4.0)" or older.*
- Select your running MFC process and click Attach.