Saturday, January 3, 2009

Edit and Continue vs. Lambda Expressions

Microsoft giveth and Microsoft taketh away. One of the amazing gifts of .Net 3.5 is lambda expressions. Once you start using them, it's hard to stop. Unfortunately, lambda expressions are not compatible with another innovation: Visual Studio's Edit and Continue (or EnC). If you try to edit code with lambda expression while debugging in VS you get the following:

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

According to this post, EnC is also incompatible with anonymous methods, a limitation present since .Net 2.