Edit and continue feature stopped working in Visua

2019-01-13 19:58发布

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?

18条回答
不美不萌又怎样
2楼-- · 2019-01-13 20:30

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 worked for me.

查看更多
在下西门庆
3楼-- · 2019-01-13 20:31

For who still gets this error even with Visual Studio 2017

No dynamic/Portable Class Libraries/Nuget packages or dependancy problems. No errors or warning highlighted by Visual Studio.

After hours spent trying all the solutions posted in this and other threads and webpages, the only solution that worked for me was to check-in, remove the Workspace and Map&Get again.

To remove the Workspace, Source controlAdvancedWorkspaceRemove.

I'm using Visual Studio 2017 Community up to date and after a relatively fresh install on a new machine (one week and few work hours).


Methods I've tested with no success prior to the solution above

  • Made sure Edit & Continue was enabled in Visual Studio options. Untick and tick it back again
  • Deleting bin and obj for all project in solution
  • Clean and Rebuild all, restart VS / reboot in combination to the above
  • Checking compile options and Nuget packages and dll compatibility for the projects, inspired by this
  • Unloading the projects in various combinations to test dependancy problems or other issues (inspired by this)
  • Deleting solution an re-downloading it (without removing the Workspace)
  • Sign False to Embed Interop Types
  • Set <_ResolveReferenceDependencies> to true as explained here
  • Combinations of the above with restart of VS and reboots

After this, I made a check-in and downloaded the Solution on another machine running the same version of Visual Studio (2017 Community). As I didn't get the Edit&Continue issue there, I went for the Workspace removal.

查看更多
闹够了就滚
4楼-- · 2019-01-13 20:33

In VS2013 I had to enable "Use Managed Compatibility Mode" in the debugging options. I think it is because I have a .Net 4 project referencing a .Net 2 assembly.

For another project in the same solution I had to uncheck "Define TRACE constant" in the project properties.

查看更多
我只想做你的唯一
5楼-- · 2019-01-13 20:34

I tried all the above solutions none of them worked for me. However, when I deleted the bin and object folders in visual studio and run again, it start to work.

查看更多
叛逆
6楼-- · 2019-01-13 20:37

I had this problem in Visual Studio 2013, and :-

  • Sometimes just closing and reopening the solution works, but when that doesn't
  • restarting Visual Studio (Close solution, exit Visual Studio, Re-open Visual Studio, re-open solution, re-try debugging with Edit & Continue) fixes it.

In my case, I didn't have any Interop types that were embedded, nor did any of my code have the dynamic keyword, and I had performed a full solution clean without success. I had been running, debugging and re-starting many times, however, so it may have had something to do with memory -- it took Visual Studio more than one minute to close, during which time the disk was thrashing (presumably memory paging at play).

查看更多
Luminary・发光体
7楼-- · 2019-01-13 20:37

In my situation, someone added a Reference to the Project's output into the Reference list: in Solution Explorer look under [ProjectName]\References for [ProjectName*] and remove it.

If the project is relying on code from a copy of itself, you can't 'Edit and Continue'. In the warning list you may or may not (more likely to in a larger project) have 'conflicts with imported type' messages if this is the cause of the problem.

查看更多
登录 后发表回答