C# Edit and Continue: error 4019
Adding a 'block' around an active statement will prevent the debug session from continuing while Edit and Continue is enabled
This error indicates that you tried to add an exception-handling block around the active statement, which Edit and Continue does not support while debugging. The blocks that can cause this error are:
A catch/finally block around an active statement.
A foreach/using/lock/fixed block around an active statement.
A try block around an active statement that is not in the top frame of the call stack.
For example, consider the following code:
class Example
{
static void Main()
{
System.Console.WriteLine("Main");
}
}
If you set a breakpoint on the WriteLine call, then start to debug the application and try to add try {} finally { } with the finally block enclosing the WriteLine call, this error occurs.
To correct this error
Choose Undo from the Debug menu to undo the changes.
–or–
On the Debug menu, click Stop Debugging, then make the changes, and start a new debugging session.
See Also
Reference
try-catch-finally (C# Reference)