
Dynamic Debugging exposes the function you need while the rest of the program stays optimized.
C++ Dynamic Debugging lets you debug an optimized x64 C++ build in Visual Studio with much of the source-level experience you expect from a Debug build. It creates an alternate, deoptimized version of code for functions you break in or step into, while the rest of the application continues to run optimized. As of November 12, 2026, Microsoft says the feature is generally available in all Visual Studio 2026 channels and in Microsoft C++ Build Tools version 14.52.
Key takeaways
- C++ Dynamic Debugging is designed for x64 native C++ projects that need Release-build performance during a debugging session.
- It uses the MSVC
/dynamicdeoptcompiler option and the matching/DYNAMICDEOPTlinker option. - A breakpoint in a function, or stepping into a function, can cause Visual Studio to use its alternate deoptimized binary for that function.
- Whole Program Optimization with
/GLis incompatible with this workflow, and Visual Studio turns it off when possible. - You should use a separate debug-oriented Release configuration instead of changing the build configuration you ship.
Why optimized C++ code is hard to debug
Beginners usually start with the Debug configuration. That is the right place to learn because the compiler preserves a close relationship between the source file you wrote and the instructions the CPU runs.
But real bugs do not always appear in a Debug build. Timing changes, memory layout changes, thread scheduling changes, and performance-sensitive code paths can all make a problem disappear after you switch configurations. You may need to investigate the optimized build that reproduces the issue.
That is where normal Release debugging gets frustrating. The optimizer is allowed to inline functions, remove values that are no longer needed, reuse CPU registers, merge code paths, and rearrange instructions. The running program can still be correct, but the debugger may no longer have a simple answer for a source-level request such as, “What is the value of this local variable on this line?”
This behavior is not unique to MSVC. Intel explains that higher compiler optimization levels can improve executable size and runtime speed while making source-level debugging harder because variables or even complete blocks can be removed. LLVM documentation also describes how optimization passes can alter or remove the instruction locations used to represent source variables.
For example, Visual Studio may show a local as unavailable, move unexpectedly when you press Step Over, or refuse to place a breakpoint on a source line that has no matching instruction in the optimized binary. None of those symptoms automatically means that Visual Studio is broken. They are a normal consequence of asking a source-level debugger to describe heavily transformed machine code.
What C++ Dynamic Debugging changes

The build produces optimized output and alternate output for on-demand debugging.
Microsoft's C++ Dynamic Debugging documentation describes the core idea: the build produces both optimized output and alternate deoptimized output. During debugging, when you set a breakpoint in a function or step into one, Visual Studio can load the alternate code for that function.
This is function-level, on-demand deoptimization. You are not running the entire process as an unoptimized Debug build. The function you need to inspect gets the friendlier debugging treatment, and other code remains optimized.
The alternate artifacts use an .alt name by default. A build of sample.exe, for example, can also produce sample.alt.exe and matching alternate debugging artifacts. When Visual Studio switches a function to the alternate version, the Call Stack can show the alternate executable name.
Microsoft first introduced the feature as a preview capability in Visual Studio 2022 version 17.14 Preview 2. Microsoft announced its general availability on November 12, 2026, for Visual Studio 2026 and MSVC Build Tools 14.52. The older documentation pages may still use Preview labels, so check the Visual Studio channel and MSVC toolset installed on your machine before treating an older limitation as current.
| Approach | What runs | What you can usually inspect | Best use |
|---|---|---|---|
| Debug configuration | Mostly unoptimized code | Locals, source lines, and calls are easier to follow | Normal development and learning |
| Normal Release configuration | Optimized code | Some values and lines may be unavailable or misleading | Performance testing and release verification |
| Release with Dynamic Debugging | Optimized code, with alternate code used for selected functions | Locals and stepping in deoptimized functions | Bugs that reproduce only with Release-like performance |
Requirements and limits you should know first
C++ Dynamic Debugging applies to x64 C++ projects. It is an MSVC and Visual Studio feature, so do not expect it to change the behavior of a project compiled with another compiler or a binary built elsewhere.
The build must include debug information. The MSVC documentation lists /DEBUG or /DEBUG:FULL as requirements for the linker. /DEBUG:FASTLINK is incompatible. In Visual Studio project settings, use the normal project configuration pages instead of adding a collection of flags before you understand the conflicts.
Several settings cannot be used together with Dynamic Debugging. Important examples include Whole Program Optimization, represented by /GL; Edit and Continue, represented by /ZI; AddressSanitizer, represented by /fsanitize=address; and C++/CLI options such as /clr. The linker setting /INCREMENTAL is also incompatible.
Identical COMDAT folding, /OPT:ICF, deserves special attention. Microsoft warns that it can remove functions from the alternate file and make the experience worse. When you enable the feature from Visual Studio project properties, Visual Studio turns off incompatible options when it can. Explicit flags that your project adds manually may still need your attention.
There is a trade-off: your build creates more outputs and does more work than a normal optimized build. Keep this configuration for local investigation, test environments, or a controlled bug-reproduction build. Do not assume it is the exact binary set you should package and ship.
Set up a beginner-friendly ReleaseDD configuration
I recommend creating a separate configuration named ReleaseDD. This avoids changing the Release configuration used by your team, CI pipeline, or product packaging process.
- Open your C++ solution in Visual Studio 2026.
- Select Build > Configuration Manager.
- Choose <New...> in the active solution configuration list.
- Name the configuration
ReleaseDD. - Copy settings from
Release, then select OK. - Set the solution platform to
x64. - In Solution Explorer, right-click the C++ project and select Properties.
- Select Configuration Properties > Advanced.
- Set Use C++ Dynamic Debugging to Yes.
- Rebuild the solution. Do not rely on an incremental build after changing compiler and linker settings.
The Visual Studio setting adds the Dynamic Debugging switches for you. It also handles some incompatible settings, including Whole Program Optimization. If the Output window reports an MSB8088 diagnostic about dynamic debugging and whole-program optimization, open Configuration Properties > Advanced > Whole Program Optimization and set it to Off.
For custom build systems, the underlying switches are /dynamicdeopt for cl.exe, plus the corresponding /DYNAMICDEOPT option during linking. Microsoft says that projects using static libraries must apply the option consistently to the compiler, librarian, and linker steps that create the final debugged binary.
Try it with a small C++ program
This sample calculates a small result in a loop. It is intentionally simple. The point is to give you variables such as row, column, and value to inspect in a Release-like build.
#include <iostream>
__forceinline int CalculateCell(int row, int column)
{
int value = (row * 10) + column;
if ((value % 2) == 0)
{
value += 5;
}
return value;
}
int main()
{
int total = 0;
for (int row = 0; row < 4; ++row)
{
for (int column = 0; column < 5; ++column)
{
int value = CalculateCell(row, column);
total += value;
}
}
std::cout << "Total: " << total << '\n';
return 0;
}Build the project first as ordinary Release | x64. Put a breakpoint on total += value;, start debugging, and open Debug > Windows > Locals. Depending on the compiler output, you may find that a local is unavailable or that stepping does not follow the source in the way you expect.
Now switch to ReleaseDD | x64, rebuild, and run again. Put a breakpoint inside CalculateCell or step into it from the call site. Visual Studio should deoptimize that function for the debugging session. Look at the Locals window for row, column, and value. You can also inspect the Call Stack to see whether the alternate binary is being used.
The __forceinline keyword is useful in this example because it reflects a common Release-build problem. Inlined functions can be difficult to enter during ordinary optimized debugging. Dynamic Debugging is intended to let you step into functions, including force-inlined ones, through the alternate output.
Use breakpoints to choose what becomes easier to debug

Breakpoints and Step Into can select the function Visual Studio deoptimizes.
A breakpoint is more than a pause marker with this feature. Setting one inside a function is one way to request deoptimization for that function. When execution reaches it, Visual Studio can give you an unoptimized source-level view of that function.
You can also step into a function. If you step over it, the function generally remains optimized. This matters when you are investigating a hot loop and only want to inspect the helper function that seems suspicious. Step into that helper instead of turning every call into a slower debugging target.
The Call Stack window has another useful command: right-click a function and choose Deoptimize on next entry. Use this when execution is already paused in a related path and you want to inspect locals the next time a function runs, without first placing a source breakpoint inside it.
Visual Studio groups those manual requests in the Breakpoints window under Deoptimized Functions. Delete that breakpoint group to let the selected functions return to optimized behavior. You can remove normal breakpoints with Debug > Delete All Breakpoints.
Conditional breakpoints work better in deoptimized functions
Conditional breakpoints are useful when a loop runs hundreds or thousands of times. In the sample, you can put a breakpoint on int value = CalculateCell(row, column);, right-click it, select Conditions, and use this expression:
row == 2 && column == 3With ordinary optimized code, the variables in that condition may not have a dependable source-level location. After the relevant function is deoptimized, Visual Studio can work with the local values in the alternate version of the function.
You can also create a dependent breakpoint. For example, set one breakpoint at the start of a suspicious operation, then configure a second breakpoint to activate only after the first one is hit. This lets you avoid stopping every time through a loop and keep the session focused on the order of events that reproduces the bug.
When to disable deoptimization
Dynamic Debugging is for investigation, not for every debugging job. At times, you need to study the real optimized instructions, confirm instruction scheduling, or see whether a breakpoint affects a timing-sensitive failure. In those cases, keep the code optimized.
In Visual Studio, open Tools > Options > Debugging > General and clear Automatically deoptimize debugged functions when possible (.NET 8+, C++ Dynamic Debugging). The next debugging session will not automatically deoptimize functions.
You can also work from the Disassembly window. Microsoft documents that stepping into a function from the focused Disassembly window does not deoptimize that function. This is the right route when assembly-level behavior is the subject of the investigation.
To disable the capability entirely for a binary, omit /dynamicdeopt from the relevant build steps. If a project has third-party libraries that you cannot rebuild, Microsoft also documents that omitting the option during final linking disables Dynamic Debugging for the final binary.
Use it with Unreal Engine projects
Unreal Engine 5.6 and later support C++ Dynamic Debugging through Unreal Build Tool and Unreal Build Accelerator. In a target file, enable it with the Windows platform setting shown below, then rebuild the target with an MSVC toolchain.
public class MyGameEditorTarget : TargetRules
{
public MyGameEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
WindowsPlatform.bDynamicDebugging = true;
}
}You can instead place bDynamicDebugging in Unreal's BuildConfiguration.xml. Epic's Build Configuration documentation lists the setting and notes that it applies to Visual Studio Dynamic Debugging when the compiler and linker are MSVC and link-time code generation is not enabled.
That last condition matters. If you work on an Unreal project, verify the build output and target rules instead of assuming that adding one line has changed every target. Editor, game, client, and server targets can use different rules.
Frequently asked questions
Does C++ Dynamic Debugging replace Debug builds?
No. Debug builds remain the simplest choice for normal development. C++ Dynamic Debugging helps when a bug requires the performance and behavior of an optimized x64 build.
Does C++ Dynamic Debugging run the entire application without optimization?
No. Visual Studio uses alternate deoptimized code for functions you break in, step into, or explicitly mark for deoptimization. Other code can remain optimized.
Which Visual Studio projects can use C++ Dynamic Debugging?
The feature is for x64 native C++ projects built with MSVC. Microsoft announced general availability for Visual Studio 2026 channels and MSVC Build Tools 14.52 on November 12, 2026.
Why did enabling C++ Dynamic Debugging turn off Whole Program Optimization?
Whole Program Optimization uses /GL, which is incompatible with C++ Dynamic Debugging. Visual Studio turns off conflicting settings when possible, but manually supplied command-line flags may need to be removed.
Can I use C++ Dynamic Debugging with Unreal Engine?
Yes. Unreal Engine 5.6 and later support it through WindowsPlatform.bDynamicDebugging = true; or the equivalent BuildConfiguration.xml setting, subject to the MSVC and link-time-code-generation conditions documented by Epic.
Based on reporting by Microsoft Learn, Microsoft C++ Team Blog, Epic Developer Community and Intel Developer.

Join the conversation! Your thoughts help the community grow.