views:

169

answers:

2

I have a seemingly innocent code snippet, which I typed into Visual Studio 2008 Immediate Window.

? results.Join(lstDocs, Function(docID) docID)
Evaluation of lambda expressions is not valid in the debugger.

As the message says, it's not possible to call a lambda expression in the debugger.
Why is it not allowed?

+1  A: 

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

It's impossible by design. Lambda expressions need to generate code on the fly in the immediate window. The debugger and/or evaluater cannot handle this. If you really want to know why, ask the developers of VS. Maybe this is an upcoming feature somewhen. Lambda expressions is a bearly new feature

Scoregraphic
+3  A: 

Here: Why is LINQ absent from debugger windows?

And this previous question: VS debugging “quick watch” tool and lambda expressions

In short, complexity.

Jason
@Jason: Your summary sums it up right, according to what I read. Thanks.
Sung Meister