Edit and continue feature stopped working in Visual Studio 2010

25,415

Solution 1

The Edit and Continue feature does not work with the dynamic keyword.

I tried to remove the method that uses a dynamic parameter, and the converted project now works on Visual Studio 2010.

Internet research reveals that is is a bug that has been reported to Microsoft. The link below has more details:

Solution 2

In the Solution Explorer view, right-click on each reference of References, choose Properties. In the Properties view, sign False to the field of Embed Interop Types. This works for me.

Solution 3

I had some Excel file "embed interop types" == true. When I changed it to false, edit and continue started working.

Solution 4

I had used Microsoft's profiler yesterday and afterwards my "Edit and continue" feature got away. I finally realized after hours of frustration that I needed to execute VsPerfCLREnv /globaloff command from command prompt and restart my computer. Now I have my Edit and continue future back. It has nothing to do with target platform by the way. It works with target platform set to Any CPU without any hassle.

Solution 5

I understand this post is old, but I had this issue lately, and this blog post shows me how to fix it.

  • Delete the obj folder
  • Delete the bin folder. You can copy and paste libraries, data files, etc...back to the folder after removal.
  • From VS, menu Solutions -> Clean solution.

This works for me multiple times.

Share:
25,415

Related videos on Youtube

Cracker
Author by

Cracker

Updated on May 12, 2021

Comments

  • Cracker
    Cracker about 3 years

    The Visual Studio Edit and Continue feature stopped on Visual Studio 2010, and I don't know what has caused the problem.

    I am working on a Windows application program using C#. This application was initially developed in Visual Studio 2008, and later upgraded to Visual Studio 2010.

    Everything was working fine, including Edit and Continue, until I upgraded the .NET Framework from 3.5 to 4.0.

    Now when I use debug mode, changing any line of the code in the IDE results in the following message:

    Edits were made which cannot compiled. Execution cannot continue until the compile errors are fixed.

    Actually, there are no compilation errors, and I must restart the Visual studio to get the updates to run.

    How can I get Edit and Continue to work again?

    • Daniel Casserly
      Daniel Casserly over 13 years
      have you tried reinstalling visual studio or the .net framework 4?
    • Cracker
      Cracker over 13 years
      no I'm still trying to figure out the problem
    • Cody Gray
      Cody Gray over 13 years
      Are you positive that no compiler error was detected? I've never seen this behavior before, and I'm suspicious of its reproducibility.
    • Joel
      Joel over 10 years
      I've come across same problem with VS 2012. Pretty sure that I've got no compiler error (stopping and debuging again works perfectly fine), but I completely lost VS edit and continue as it presents exactly that error message.
    • Ben
      Ben over 6 years
      Ive gotten this error as well when working with multiple people who have some modified settings. It comes and goes, but Edit and Continue is always enabled. Seems to come and go. I would encounter it even when adding a comment to my code.
    • PHPGuru
      PHPGuru about 3 years
      I added an answer. I had to rename one of my class files. You can not have two files with the same .cs filename in the same project or continue and edit doesn't work with .net core 3.1
  • Cracker
    Cracker over 13 years
    I did and the problem still exist.
  • Hans Olsson
    Hans Olsson over 13 years
    @cracker: I'd try the following: Change the project back to 3.5 (just to see if it stops breaking), go through the .sln and proj files (wherever the framework version is specified, I don't have VS2010 here now to check) to see if there's any discrepancies (one file says 3.5 and another 4.0 or similar), create a new 3.5 project in VS2008, upgrade it to VS2010 and then change it to 4.0 and see what happens. I'm not sure if any of these suggestions will solve anything, but they might give you more information for finding the issue.
  • Cracker
    Cracker over 13 years
    when i changed the project back to 3.5 Visual Studio working fine and I can edit during debugging, but this project requires some features from the .net 4.0 and for that we upgraded to Visual Studio 2010, so I've to solve this problem on the 2010 Version
  • Hans Olsson
    Hans Olsson over 13 years
    You should flag this answer as correct (since it's the best one, doesn't matter that it's your own answer). Also, just so that you're aware, if you want to write respond in a comment to someone you should use the @username syntax you might have seen in other comments, that way they'll get notified of your responses.
  • sbenderli
    sbenderli over 12 years
    i had added a new reference, and it had stopped working right after that. sure enough, Embed Interop Types was set to True by default, and setting it to False worked! Thank you!!
  • Joel Barsotti
    Joel Barsotti over 12 years
    I also had this exact same problem and this was the fix for me.
  • Torre Lasley
    Torre Lasley almost 12 years
    I only had two references with Embed Interop Types = True and when I changed them to False it worked. Thanks!
  • skimania
    skimania over 11 years
    Hmm... I have this problem as well, however, my colleague can Edit and Continue with the same reference set to true. Why would this work on one machine and not another? (Same solution, same line of code!)
  • Riki
    Riki almost 11 years
    This is the answer I was looking for. I wasn't using the dynamic keyword like "cracker" (accepted answer)
  • Grant Johnson
    Grant Johnson over 10 years
    The last comment when I am writing this asked why the same referenced assemblies that have true for Embed Interop Types work on some machines and not others. I've noticed this across projects referencing the same assemblies on the same machine. I had a working project where Edit and Continue worked fine and I tried to make everything the same on the project that would not let me edit and continue. Nothing was working until I found this post. I work with a lot of hardware so I have references to the different instrument dlls all over the place.
  • Saintali
    Saintali over 9 years
    A text search for <EmbedInteropTypes>True</EmbedInteropTypes> across the solution may save a lot of time.
  • Mark Miller
    Mark Miller over 9 years
    I experienced this issue in VS 2013. "VsPerfCLREnv /off" (and rebooting) worked for me. I found this program in "c:\Program Files (x86)\Microsoft Visual Studio XXX\Team Tools\Performance Tools" (XXX is the VS version number).
  • carlin.scott
    carlin.scott over 9 years
    I tried just restarting VS without success but rebooting fixed the issue for me.
  • Dowlers
    Dowlers over 7 years
    I tried all the other solutions in this thread and this is the only one that worked for me.
  • bokibeg
    bokibeg almost 7 years
    I don't have 'EmbedInteropTypes' anywhere in the solution and no use of dynamic keyword - still experiencing the issue. Rebuilding the solution fixes it but only temporarily.
  • Chase07
    Chase07 over 6 years
    It works for me after I done above and reboot my computer !
  • Sinus the Tentacular
    Sinus the Tentacular almost 6 years
    In my case, enabling "Managed Compatibility Mode" made my Edit-and-Continue feature stop working completely: even an attempt to edit was blocked with an "Edit and Continue is not supported in Managed Compatibility Mode" message. This was on VS Community 2017.
  • Grant Johnson
    Grant Johnson over 3 years
    Thanks for pointing this out. I'm working with a WinForms project that has an Active X control on it. When I drop the control named CableEye.ocx into my form it adds two references to my project called AxCableEyeCtl and CableEyeCtl that both reference the project obj folder in their path variable. Maybe WinForms projects with Active X controls are an automatic no go for 'Edit and Continue' functionality? I'm very inexperienced with Active X controls but I thought it might be worth at least being aware of.