问题
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:
Here: Why is LINQ absent from debugger windows?
And this previous question: VS debugging “quick watch” tool and lambda expressions
In short, complexity.
回答2:
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
来源:https://stackoverflow.com/questions/1907983/why-is-evaluation-of-lambda-expressions-is-not-valid-in-the-debugger