Visual Studio 2015 brings us several long-requested improvements to the debugging process, not the least of which is support for evaluation of lambda expressions. We can finally be rid of the “Expression cannot contain lambda expressions” message that has frustrated many a developer deep in the midst of a debugging session.

There are 3 ways we can now evaluate lambda expressions while debugging: in the watch window, in the immediate window, and directly in a debugger window. Each of them gives us similar options and flexibility, such as error reporting, expansion and enumeration of results, and saving our expressions for future debugging sessions. The best way to see how this works is to view it in action in Visual Studio 2015:

Take a look and then try it out yourself, and enjoy debugging those lambda expressions!

The following two tabs change content below.