8

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?

dance2die
  • 35,807
  • 39
  • 131
  • 194

2 Answers2

5

Here: Why is LINQ absent from debugger windows?

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

In short, complexity.

Community
  • 1
  • 1
jason
  • 236,483
  • 35
  • 423
  • 525
1

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
  • 7,110
  • 4
  • 42
  • 64