Ask a questionAsk a question
 

AnswerOrcas - Edit and continued not working when linq used

  • Monday, July 09, 2007 10:12 PMMattCheshire Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Set a break point as usual and want to a little edit and continue and hit F10 to move on (works fine most of the time), however when any linq is used such as <<Collection>>.Single<>() in the method edit and continue won't work (even though I'm not acutally touching the linq part)


    Error    1    Modifying a 'method' which contains a lambda expression will prevent the debug session from continuing while Edit and Continue is enabled.   ProductlManager.cs    26    9  

    Will this be fixed or is edit and continue gradually doomed as C# 3.5 features take hold?

Answers

  • Monday, July 09, 2007 10:51 PMTom Meschter MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    This isn't a bug so much as it is a limitation of the environment in which Edit and Continue operates. EnC can modify IL, but not types--that is, it can't add fields or methods to a type, remove a type, or create a new one. Lambda expressions that capture local variables can result in the creation of hidden types under the hood. Modifying a method containing a lambda expression could change the locals that are captured, which would require changing the hidden type. The same limitation has existed with anonymous methods since C# 2.0 and VS 2005.

     

    EnC is not allowed in methods that utilize anonymous types or query expressions for similar reasons. That being said, we have no intention of abandoning EnC. We will be looking to improve the capabilities of EnC as we move forward; we just can't support these scenarios right now.

     

    -Tom Meschter

    Software Dev, C# IDE

All Replies

  • Monday, July 09, 2007 10:51 PMTom Meschter MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    This isn't a bug so much as it is a limitation of the environment in which Edit and Continue operates. EnC can modify IL, but not types--that is, it can't add fields or methods to a type, remove a type, or create a new one. Lambda expressions that capture local variables can result in the creation of hidden types under the hood. Modifying a method containing a lambda expression could change the locals that are captured, which would require changing the hidden type. The same limitation has existed with anonymous methods since C# 2.0 and VS 2005.

     

    EnC is not allowed in methods that utilize anonymous types or query expressions for similar reasons. That being said, we have no intention of abandoning EnC. We will be looking to improve the capabilities of EnC as we move forward; we just can't support these scenarios right now.

     

    -Tom Meschter

    Software Dev, C# IDE