Native code debugging in Visual Studio is controlled not by a single switch but by the debugger engine selected for a project or launch profile, and by whether the managed or JavaScript debugger is configured to step into native code alongside the code you are already debugging. For a C++ project, native debugging is always on; you do not enable it, and you cannot meaningfully turn it off. For a managed (.NET) project, you enable it through the project's debug properties, the launch profile, or the Attach to Process dialog by turning on native-code debugging. For a mixed-mode project that contains both managed and native code, the setting is on by default. Understanding which case you are in removes almost all of the confusion around this setting.
The direct answer depends on what kind of code you are debugging
Visual Studio ships with several debuggers that share one interface. The managed debugger handles .NET code, the native debugger handles C and C++ (and other compiled binaries such as Rust or Go that emit standard Windows debug information), and the JavaScript debugger handles browser and Node.js code. "Native code debugging" is the act of attaching the native debugger, either alone or in combination with one of the others. So the practical instructions divide into three scenarios.
Pure native C++ project. Native is the only engine that applies. The project's Debug properties expose options like the debugger type and the debugger to launch, but none of them switches native debugging off. If you want to debug your C++ executable, it is already enabled.
Managed or JavaScript project that calls native code. Native debugging is off by default because the managed debugger is faster and lighter, and most .NET and web debugging never needs to cross into native library code. You turn it on per project, per launch profile, or per attach session.
Mixed-mode (managed plus native) project type. Visual Studio's C++/CLI and some game or Office add-in project templates compile both kinds of code. These projects request the mixed debugger by default, so native stepping is available immediately.
The reader's real question is usually one of two things: "I selected 'Enable native code debugging' and my program got slower or hit a breakpoint in code I did not write—how do I stop that?" or "My .NET application crashes inside a third-party DLL and I want to step into it—how do I turn it on?" Both are answered below.
Enabling native code debugging for a managed project
Open the project's properties (right-click the project in Solution Explorer, then Properties, or press Alt+Enter) and select the Debug page in the left pane. The exact layout depends on the project type and Visual Studio version, but the relevant control appears under the general debug settings and is labeled Enable native code debugging or is part of an Open debug launch profiles UI dialog.
There are two common presentation styles:
Newer .NET projects use launch profiles. Selecting the Debug page may show a link reading "Open debug launch profiles UI." Opening it presents a table of profiles with columns for launch type, executable, arguments, environment variables, and a checkbox for Enable native code debugging. Select the profile you actually use (IIS Express, the executable, or Project) and check the box. The setting is stored in launchSettings.json under the project's Properties folder, which means a colleague can inherit it through source control unless that file is excluded. Older project formats (for example, .NET Framework projects) show the checkbox Enable native code debugging directly on the Debug properties page, under the "Enable Debuggers" heading.
In either style, the option tells the debugger to load the native debug engine together with the managed engine. Once on, you can step from managed code into a native function and inspect native call stacks in the Call Stack window. The cost is slower startup and more memory usage, and some operations (expression evaluation in mixed frames) can produce confusing results because the two engines answer in different type systems.
To disable it, clear the same checkbox and save. If the behavior persists, confirm the checkbox state on the profile you are actually running rather than on a different profile in the list, which is a frequent source of "the setting didn't take" reports.
When the option appears grayed out
Two situations typically gray out or hide the native debugging option. First, if the active solution platform or configuration does not produce native code—or if the project explicitly targets an architecture where the native and managed engines conflict—the checkbox may be disabled. Second, if you are editing a publish profile rather than a debug profile, native debugging is not offered, because publish configurations do not attach a debugger. Switching back to a Debug build configuration and a debug launch profile restores the checkbox.
Disabling native code debugging when it keeps stopping in unwanted code
A very common complaint is that a .NET or web application unexpectedly breaks inside a native Windows system DLL or a third-party library. Two different settings can cause this, and it is worth separating them.
The native debugger is enabled. When native debugging is on, breakpoints anywhere in the loaded native code, including breakpoints set by the library author, can be hit. Disabling native debugging removes those breakpoints from the session.
Just My Code is turned off. Just My Code is a Visual Studio feature that filters the debugger to your code and code you step into. It applies to the managed and JavaScript debuggers and to some extent affects how native frames are presented in mixed sessions. If Just My Code is disabled, the debugger will stop in framework and library code that it would otherwise skip. The setting lives under Tools > Options > Debugging > General, as Enable Just My Code.
These settings are not interchangeable. Turning off native debugging stops the native engine; enabling Just My Code keeps the native engine but filters what it stops on. If you need to debug native code occasionally but do not want to hit external breakpoints most of the time, keep native debugging on and keep Just My Code on. If you never touch native code, turn native debugging off.
A related trap involves exceptions. If Break when this exception type is user-unhandled or the older "Break on all exceptions" settings are active, a crash inside a native DLL may stop the debugger even when native debugging is disabled, because first-chance exception handling is partly independent of the engine. Check Debug > Windows > Exception Settings (Ctrl+Alt+E) and make sure the relevant exception categories are not set to break.
Turning on native debugging through Attach to Process
When you cannot change the project, for example because you are debugging a deployed service or a process you did not build, use Debug > Attach to Process (Ctrl+Alt+P). Select the process, then click Select next to the Attach to field. In the Select Code Type dialog, choose Automatically determine the type of code to debug or pick the specific combination you need—Managed (.NET Core, .NET Framework) plus Native if you want mixed-mode stepping. Confirm the selection and attach.
This per-session selection does not persist across debugging sessions and does not modify the project. It is the cleanest way to answer the "temporarily inspect native code" need without leaving a project setting behind for everyone else.
If the process runs under a different user or at a higher elevation, run Visual Studio elevated and attach from there; the debugger can only load an engine into a process it can access. On 64-bit systems, a 32-bit Visual Studio can attach to 64-bit processes and vice versa, but the process bitness must match the binary you are debugging—if the Attach to Process list shows the wrong architecture, the native engine cannot load correctly, and the dialog's code type selection will be incomplete.
Enabling or disabling for JavaScript, Node.js, and web debugging
For Node.js projects the debug configuration exposes its own checkboxes, and on Windows, native debugging of a Node process is unusual but possible when Node is hosted inside a native process. For ASP.NET Core running under IIS Express or Kestrel, the launch profile's native debugging checkbox behaves as described above. For browser JavaScript, the Chrome or Edge debugger is its own engine, and the "native code" concept refers to WebAssembly or the browser's native internals; enabling the browser's native debugging is not a standard Visual Studio project setting and usually requires a separate toolchain.
For .NET running under WSL or a Docker container, native debugging is supported only for processes on the local Windows machine. If a .NET containerized app calls into a Linux native library, Visual Studio cannot attach the native debugger to it through the project's checkbox.
A quick comparison
| Situation | Is native debugging on? | How to change it |
|---|---|---|
| C++ desktop project | Yes, inherently | Not applicable; native is the only engine |
| C++/CLI mixed-mode project | Yes by default | Project properties, debugger type |
| .NET console or app, Debug page | Off by default | Project Properties > Debug > Enable native code debugging (or launch profiles UI) |
| Attach to Process session | Chosen per session | Debug > Attach to Process > Select code type |
| Any session, stopped in framework code | Depends on engine settings | Tools > Options > Debugging > General > Enable Just My Code |
Why the setting exists and why it is not default
The native debugger has more to do. It reads Program Database (PDB) symbols, handles structured exception handling differently from the managed runtime, and evaluates expressions against native type layouts that have no managed equivalent. Starting it alongside the managed engine slows launch and increases memory use, and it can confuse expression evaluation. Visual Studio therefore opts in rather than making mixed-mode stepping universal. The design also reflects history: the managed debugger grew out of the COM and .NET debugging worlds, and early versions kept the two engines more separate than they are today. Modern Visual Studio coordinates them closely, which is why the mixed experience works at all, but the opt-in default survived because most managed debugging simply does not need it.
It is also worth knowing where the setting is stored. Project-level native debugging belongs to the launch profile, not the solution, so a build server or continuous integration pipeline never sees it. Attach-time selection lives only in the current session. This is why "enable web server native settings" or "settings are not saved" reports almost always trace back to the wrong profile, an excluded launchSettings.json, or a publish profile rather than a debug profile.
Common misconceptions
"Enabling native debugging makes my program native." It does not. It only loads an additional debug engine. "Disabling native debugging prevents crashes in native DLLs." It does not. You simply cannot step into that code, but the process still crashes the same way. "The setting is global." The engine selection is per profile or per attach session; Just My Code is the genuinely global switch under Tools > Options. "Native debugging is unavailable in .NET." It is available in many .NET configurations. It is unavailable when the platform or host architecture cannot run the native engine, such as remote or container debugging scenarios.
With those distinctions in hand, the setting behaves predictably: you are choosing which debug engines participate in a session, not toggling a property of your compiled program.