Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Tuesday, January 19, 2016

Edit and Continue:

Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"



Even if I create a clean WinForms project, Edit and Continue doesn't work and gives me the error mentioned above.

  1. Edit and Continue option is checked in Tools -> Options -> Debugging.
  2. Optimization is not enabled.
  3. Seems like there is no any managed profiler set up.
  4. I am running in Debug mode
  5. I am running on x64 CPU and Windows XP 32-bit, but setting platform target to x86 rather than AnyCpu doesn't help.
  6. Repairing Visual Studio installation doesn't help.

I also found this article on MSDN website: http://msdn.microsoft.com/en-us/library/ms164927(VS.80).aspx :

Unsupported Scenarios

Edit and Continue is not available in the following debugging scenarios:

  • Debugging on Windows 98.

  • Mixed-mode (native/managed) debugging.

  • SQL debugging.

  • Debugging a Dr. Watson dump.

  • Editing code after an unhandled exception, when the "Unwind the call stack on unhandled exceptions" option is not selected.

  • Debugging an embedded runtime application.

  • Debugging an application with Attach to rather than running the application with Start from the Debug menu.

  • Debugging optimized code.

  • Debugging managed code when the target is a 64-bit application. If you want to use Edit and Continue, you must set the target to x86. (Project Properties, Compile tab, Advanced Compiler setting.).

  • Debugging an old version of your code after a new version failed to build due to build errors.

But I can answer "No" to every item in this list.

It worked before, but several days ago it stopped working, and I don't know what could be the reason.

Answer by JaredPar for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


Couple of things to check

  • Make sure your compile is set to Debug vs. Release
  • Make sure you're not launching a mixed mode process
  • If on a 64 bit machine Make sure to set the CPU target to x86 rather than AnyCPU

EDIT

I don't believe this should matter but make sure that the hosting process is enabled for the target platform. Probably won't help.

If it repros for new projects then it might be something even more subtle. I would try the following.

  • Backup HKCU:\Software\Wow6432Node\VisualStudio\9.0 (maybe just rename it)
  • Delete the same key
  • Try the repro again

Answer by Richard Hein for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


That happens when the debugger hasn't hit a breakpoint or you haven't hit Break All (pause). It couldn't be that simple could it?

Answer by Pejvan for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


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.

Answer by Amer for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


I had the same problem. I even re-installed VS 2008 but the problem did not go away. However, when I deleted all the break points then it started to work.

Debug->Delete All Breakpoints  

I think it was happening because I had deleted an aspx page that had break points in its code, and then I created another page with the same name. This probably confused the VS 2008.

Answer by pbalaga for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


The error says a possible cause is: "the code being debugged was optimized at build or run time". Go to Project Properties->Debug and uncheck the Optimize Code box for Debug mode.

Answer by Samuel for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


For me, for a reason that I don't understand, the setting "Generate debug info" in the "Advanced Compiler Settings" was set to "pdb-only" instead of "Full".

By default, this parameter is always set to "Full" but a mysterious poltergeist has changed this parameter on last night. :)

P.S. I'm in Visual Basic .Net with Visual Studio 2010

Answer by Greg for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


If I create a new project, edits while debugging do not work. If I create a new website, edits while debugging work as expected.

Answer by Yuriy Vikulov for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


In my case just reseting to default debugger settings and setting IntelliTrace-> only intellytrace events helps

Answer by JayW for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


None of the above solutions worked for me(running on a 64x machine).

Finally I clicked on 'advanced compiler settings' and UNCHECKED 'enable optimizations' and I can now step through code and edit while debugging.

Answer by Adam for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


If your concern is with an ASP.NET app, ensure you have edit and continue enabled on the web tab (vs2010). There was also a separate setting for ASP.NET debugging in earlier versions.

Regards,

Adam.

Answer by RAL for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


I found that even though under project properties build & debug tab are set to Debug and all the other setting are correct I still get the message, however after digging some more under the Build menu select Configurations Manager... and make sure Debug is selected in two places there as well. go figure...how many different places do they need to set debug?????? even though you set Project - Configuration to Debug then under Build - Manager it is not changed so you have change the same setting there as well Project Configuration - seems like a microsoft issue again.......

Answer by KuldeepVerma for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


This problem is due to Intellitrace setting

If Intellitrace is enabled make sure Intellitrace event only is checked

Otherwise this will not allow edit and continue..

If you will click on Intellitrace options you will see the warnings.

Answer by viggity for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


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.

Answer by Scott for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


Some things that seemed to help using VS2010:

  • go to Tools, Options, Debugging, General and make sure "Require source files to exactly match the original version" is unchecked.
  • multiple .vshost.exe instances can be left over from e.g. detaching the VS debugger from a stopped process. This will interfere with breakpoints and compiles as well. Use Task Manager, Processes tab to kill all instances of .vshost.exe by right-clicking each instance and selecting End Process Tree. VS will create a new instance.

Answer by ashkan_jami for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


I removed a dataset from my project because I didn't use it. After that I could modify the program when debugging.

Answer by Vinay for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


Following shooting helped me using VS2010:

go to Tools, Options, Debugging, General and make sure "Require source files to exactly match the original version" is unchecked.

Answer by user2412450 for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


I had this problem in Microsoft Visual Studio 2008 and the solution is easy. when you run your project please set in "Debug" mode not "Release". The another people solution can be useful.

Answer by stevebot for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


I did all the changes mentioned in every other answer and none worked. What did I learn? Enable and Continue exists in both the Tools > Options > Debugging menu and also in the Project settings. After I checked both, Enable and Continue worked for me.

Answer by Guy Danus for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


I ran into this today - turns out that having Debug Info set to pdb-only (or none, I'd imagine) will prevent Edit and Continue from working.

Make sure your Debug Info is set to "full" first!

Project Properties > Build > Advanced > Output > Debug Info

Answer by beppe9000 for Edit and Continue: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time"


Applicable Solutions

Here is a list of solutions to try if you* want to sort it quickly:

  • Check nightcoder's answer if it is the case
  • Make sure you are in Debug Mode
  • Make sure you're not launching a mixed mode process
  • Make sure to set the CPU target to x86 rather than AnyCPU (on x64 machines)
  • Uncheck the Optimize Code box for Debug Mode in Project Properties->Debug
  • Uncheck Enable Optimizations in Advanced Compiler Settings
  • (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.
  • Go to Tools > Options > Debugging > General and make sure Require source files to exactly match the original version is unchecked.
  • Kill all the *.vshost.exe instances by selecting End Process Tree in the Task Manager. VS will regenarate a correct instance.
  • Remove all the breakpoint 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.
  • Be sure Debug Info in Project Properties > Build > Advanced > Output > Debug Info is set to Full
  • Some plugin may be interfering. Check by disabling/unistalling 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.

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

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.