Visual Studio debugging "quick watch" tool and lambda expressions

c#, debugging, lambda, visual-studio

Solution

Lambda expressions, like anonymous methods, are actually very complex beasts. Even if we rule out `Expression` (.NET 3.5), that still leaves a lot of complexity, not least being captured variables, which fundamentally re-structure the code that uses them (what you think of as variables become fields on compiler-generated classes), with a bit of smoke and mirrors.

As such, I'm not in the least surprised that you can't use them idly - there is a lot of compiler work (and type generation behind the scenes) that supports this magic.

Problem

Why can't I use lambda expressions while debugging in “Quick watch” window? UPD: see also Link Link

Original source

Related problems