Guide
Using Edit and Continue in Visual Studio 2022 to Apply Code Changes While Debugging
Learn how to apply code changes during a Visual Studio debugging session with Edit and Continue, avoiding full rebuilds and restarts.
Published by Tasadduq Burney
16 Sept 2025, 20:42 UTC
3 min109.6K views0

Desired outcome
Make a code change during a debugging session and see the effect immediately, without stopping the debugger, rebuilding the solution, or restarting the application.
Prerequisites
- Visual Studio 2022 (or later) with the .NET desktop development workload installed.
- The solution must be built in Debug configuration.
- Edit and Continue enabled:
Debug → Options → General → Enable Edit and Continue(checkbox). - You have write permission to the source files of the project you are debugging.
Procedure
- Open the solution in Visual Studio and set a breakpoint at the line you intend to modify (e.g., inside a method that runs repeatedly). Press F5 to start debugging.
- When the breakpoint hits, locate the statement you want to change in the editor. For example, change a string literal:
// Before edit Console.WriteLine("Hello"); // After edit Console.WriteLine("Hello from Edit and Continue"); - Apply the edit:
- Press Ctrl+S to save the file, or click the Apply Code Changes button that appears in the toolbar when Edit and Continue is active.
- Continue execution with F5 (or F10/F11 for step‑through). The debugger will insert the new IL at runtime and resume without a full rebuild.
Expected checks
- The modified line executes and the new output appears (e.g., the console shows "Hello from Edit and Continue").
- Breakpoints that were set before the edit remain active and are hit as expected.
- The Locals and Watch windows display values that reflect the changed code.
- Open the Output window, filter to "Edit and Continue"; you should see a message like "Edit and Continue: applied changes" and no error messages.
Recovery options (if the edit is not supported)
Visual Studio will display a warning dialog when an unsupported change is attempted (e.g., adding a new method, changing a method signature, or modifying an async/await state). In that case:
- Revert the edit immediately (Ctrl+Z) to return to the last successfully applied state.
- If you have already accepted the unsupported edit, stop debugging (Shift+F5), rebuild the solution, and start a new debugging session.
- As a fallback, disable Edit and Continue (
Debug → Options → General → Enable Edit and Continueunchecked) and use the standard edit‑compile‑debug cycle.
Limitations and practical verification
- Structural changes (adding/removing types, modifying method signatures, changing accessibility) generally require a restart.
- Native C++ projects support Edit and Continue only when using the Microsoft native debugger and the
/Zicompiler flag is set. - Mixed‑mode debugging (managed + native) or active profiling tools may automatically disable the feature.
- To verify that Edit and Continue is active, look for the lightning‑bolt icon next to the Apply Code Changes button in the toolbar; if it is disabled, the feature is not available for the current session.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.