Edit and keep working for me at some point

I have been developing an application in C # (using VS2008) for quite some time and about a week ago “Edit and Continue” stopped working for me. I can edit the code while debugging, but any small change I make in the code now forces me to stop the project and restart it. The message I receive is the following:

Modifying a 'method' which contains a lambda expression will prevent the debug session from continuing while edit and continue is enabled.

Oddly enough, I don't even use lambda when this happens. Changing the same piece of code last week in debug mode allowed me to continue without problems. I conducted various searches on the Internet to find out what I could do to cause this change in behavior. The only help I can find on the Internet is directly related to debugging ASP.NET web projects. However, this part of my solution is a Windows Forms project.

What is the problem? Is there any way to fix this? I would really appreciate any help.

+4
source share
3 answers

"Editing and continuing is not supported when starting debugging using the Attach to Process application." Edit and continue "is not supported for mixed modes, combined controlled and native, debugging, SQL debugging, Compact Framework projects (Smart Device), Windows 98 debugging, or 64-bit debugging."

http://msdn.microsoft.com/en-us/library/ba77s56w.aspx

edit . This link talks about VB, but I'm sure I had the same problem with mixed native and managed code and 64-bit debugging when using C #.

+2
source

Just guess, but maybe the method you are debugging contains a type captured from lambda.

Below is a quote from here .

... EnC [EditAndContinue] can change IL, but not types - that is, it cannot add fields or methods to a type, delete a type or create a new one. Lambda expressions that capture local variables can lead to the creation of hidden types under the hood. Changing the method containing the lambda expression can change the locals to be captured, which will require a change of the hidden type. The same restriction exists with anonymous methods with C # 2.0 and VS 2005.

+3
source

This is a long snapshot, but you can use LINQ - it's just syntactic sugar for lambda expressions. Did you add LINQ to your code?

+1
source

All Articles