Edit and Continue: "Changes are not allowed when..."

If you're debugging an ASP.NET application, go to properties > web > Servers, and make sure that "enable and continue" is checked under Use Visual Studio Development Server.


I finally got to solve the problem: UNINSTALL Gallio

Gallio seems to have quite some many rough edges and it's better to not use MbUnit 3.0 but use the MbUnit 2.0 framework but use the gallio runner, that you are running without installing from the installer (which also installed a visual studio plugin).

Incidentally, I had the issue even after "disabling" he Gallio plugin. Only the uninstall solved the problem.

PS. Edited by nightcoder:
In my case disabling TypeMock Isolator (mocking framework) finally helped! Edit & Continue now works!!!

Here is the answer from TypeMock support:

After looking further into the edit and continue issue, and conversing about it with Microsoft, we reached the conclusion it cannot be resolved for Isolator. Isolator implements a CLR profiler, and according to our research, once a CLR profiler is enabled and attached, edit and continue is automatically disabled. I'm sorry to say this is no longer considered a bug, but rather a limitation of Isolator.


Other Applicable Solutions:

Below is an incomplete, unordered list of possible solutions to try if you* are trying to fix Edit & Continue quickly.

  • Make sure you are in Debug Mode

  • Make sure you're not launching a mixed mode process

  • Try to set the CPU target to x86 rather than AnyCPU (on x64 machines)

  • Uncheck the Optimize Code checkbox for Debug Mode in Project Properties->Debug

  • Uncheck the Optimize Code checkbox in Project Properties->Build

  • Uncheck Enable Optimizations in Advanced Compiler Settings

  • (ASP.NET) Check nightcoder's answer if it is the case

  • (ASP.NET) Check this answer (by matrixugly) if it is the case

  • (ASP.NET) Ensure you have Edit and Continue enabled on the Web tab (vs2010)

  • (ASP.NET) Go to Properties > Web > Servers, and make sure that Enable and continue is checked under Use Visual Studio Development Server.

  • (ASP.NET WebAPI) Make sure you've stopped in the Controller's method using a breakpoint, before trying to edit it.

  • (vs2017) Go to Tools > Options > Debugging and uncheck (deselect) 'Edit and Continue'. This is actually the opposite of the 'conventional' advice (see some other points in this post). It does not allow you to actually make changes in your running program (i.e. it does not hot-swap the code changes that you make) - it simply allows you to edit your code (i.e. it prevents that annoying message and "locking" your editor).

  • Go to Tools > Options > Debugging > General and make sure Require source files to exactly match the original version is unchecked.

  • Check Enable Windows debug heap allocator (Native only) [VS Community 2017]

  • Are you using Microsoft Fakes? It inhibits Edit & Continue.

  • Kill all the *.vshost.exe instances by selecting End Process Tree in the Task Manager. VS will regenerate a correct instance.

  • Remove all the breakpoints with Debug->Delete All Breakpoints

  • Enable and Continue exists in both the Tools > Options > Debugging menu and also in the Project Settings. Be sure to check both places. edit & Continue is not supported with the extended Intellitrace setting.

  • Be sure Debug Info in Project Properties > Build > Advanced > Output > Debug Info is set to Full

  • Some plugin may be interfering. Check by disabling/uninstalling and then trying again the other solutions.

  • If you're not paying enough attention, the error you get while trying to fix this may change to something else that is easier to diagnose. E.g. A method containing a lambda expression cannot support edit and continue.

  • Make sure the System variable COR_ENABLE_PROFILING is not set to 1. Some profilers set this when installing and leave it like that after uninstalling. Open a command prompt and type set to quickly check it your system is affected, if so remove the variable or set it to 0:

    • In Windows 8 and above, search for System (Control Panel).
    • Click the Advanced system settings link.
    • Click Environment Variables.
    • Remove COR_ENABLE_PROFILING
  • Be aware of unsupported scenarios (as reported in the question) and that unsupported edits.


* by 'you', I mean the visitor of the page who is hammering his head on a keyboard to find The solution.


Feel free to edit this answer to add your workaround if not listed here!