Visual Studio Edit and Continue for C#: Check Your Project Before You Rely on It
Edit and Continue lets you patch C# code mid-debug without restarting—but only when your project, runtime, and the edit itself qualify. Here's how to verify support and avoid forced restarts.
27 Apr 2026, 11:57 UTC

The problem: a logic bug appears mid-debug, but restarting is expensive
You hit a breakpoint in a running C# service. The locals window shows the wrong value, and you know the one-line fix. Restarting means rebuilding, re-authenticating, and reconstructing the request state. Visual Studio Edit and Continue (EnC) can apply the edit while the process keeps running, but only when the project, runtime, and edit itself all qualify. This post shows how to verify support before you depend on it.
What Edit and Continue requires
Edit and Continue lets the .NET runtime replace a method body in a running process without detaching the debugger. PDB files are program database files that map compiled code back to source lines and local variables. JIT compilation is the just-in-time process that turns IL into machine code.
All of the following must be true at the same time:
- The active build configuration is Debug, not Release.
- The project emits full PDB symbols (DebugType=full or DebugType=portable in SDK-style projects).
- The target runtime supports managed Edit and Continue (.NET 6 and later, or recent .NET Framework 4.8 with patches).
- The Visual Studio debugger is attached (started with F5, not Ctrl+F5).
- No native modules are loaded that force mixed-mode debugging.
If any condition fails, Edit and Continue commands stay disabled and saving a file during debugging has no effect.
Edits that usually apply versus edits that force a restart
The runtime can swap a method body, but it cannot always reshape the surrounding type layout. This table summarizes typical behavior for managed C#:
| Typically supported mid-session | Usually requires a debugger restart |
|---|---|
| Changing a variable assignment, constant, or control flow inside a method body | Adding a new class, struct, interface, record, or enum |
| Adding or removing local variables | Changing a method signature, return type, or parameter list |
| Updating a lambda or LINQ expression body | Adding or removing async/await, which changes the compiler-generated state machine |
| Editing exception handling blocks inside a method | Modifying generic type definitions, constraints, or attributes on types |
Async methods are a common surprise. The compiler rewrites an async method into a state machine struct, so adding the first await to a synchronous method changes that layout and is rejected.
Worked example: verify EnC in a .NET 8 Web API project
Run these steps in Visual Studio 2022 with a project targeting .NET 8. No administrator permissions are required for a local project.
- Open Tools > Options > Debugging > Edit and Continue. Confirm Enable Edit and Continue is selected for C#.
- Open your project file and confirm the Debug configuration contains:
<PropertyGroup Condition='$(Configuration) == "Debug"'> <DebugType>full</DebugType> <Optimize>false</Optimize> </PropertyGroup>DebugType=full produces the PDBs EnC needs. Optimize=false keeps local variable slots available for inspection.
- Press F5 to start debugging. Set a breakpoint inside a minimal API handler, for example:
app.MapGet("/widget/{id}", (int id) => new Widget(id)); - When the breakpoint hits, change the return expression to
new Widget(id + 1)and save the file (Ctrl+S). - Watch the editor margin. A green highlight means the edit was applied. A yellow tooltip reading that the change cannot be applied means the edit fell into an unsupported category.
- If the green highlight appears, press F10 to step forward and confirm the new logic executes. If you see the yellow tooltip, press Ctrl+Shift+F5 to restart debugging and test the change from a clean state.
Changes applied through Edit and Continue exist only in the running process. Stopping the debugger discards them unless you saved the source file, which serves as the practical rollback and persistence step.
Limitations and how to check the result
- Edits are ephemeral. An EnC change that is not saved is lost when the session ends.
- State mismatches can occur. If the method already mutated shared state, the new code runs against the old state, which can hide bugs that appear on a clean restart.
- Mixed native debugging blocks managed EnC. Open Debug > Windows > Modules during a session and look for native DLLs; their presence often disables managed Edit and Continue for the whole session.
- Older .NET Framework projects have stricter limits. Target .NET Framework 4.8 or later and verify with a trivial edit, such as changing a string literal inside a running method.
- EnC is not a substitute for a clean build. A change that applies in the running process may still fail a fresh checkout build, so build before committing.
Practical verification: after a successful green highlight, save the file, stop debugging, start a new F5 session, and confirm the same behavior occurs from the start. If it does not, the edit was only in memory and did not survive a clean compile.
Pre-flight checklist before relying on Edit and Continue
- Configuration is Debug with full PDBs.
- Target framework is .NET 6+ or patched .NET Framework 4.8+.
- Tools > Options > Debugging > Edit and Continue shows C# enabled.
- Modules window shows no native DLLs loaded in the session.
- A trivial edit inside a running method produces a green highlight, not a yellow warning.
When all five checks pass, use Edit and Continue for inner-loop logic tweaks. When any check fails, plan for a restart instead.