Visual Studio debugging quick watch tool and lambda expressions
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.
How to watch (i.e. debug) extra-lambda variable inside lambda scope in C#/Visual-Studio/Unity3d?
Turns out this is a variation of C# lambda call in for loop references to last object
There is an issue with Mono/Unity with coroutines and lambda expressions;
The coroutine itself is an implicit closure as well which moves all local variable to a seperate class as member variables. That means it's impossible to create a "real" local variable inside a generator method. That's why the explicit local variable declaration doesn't work.
See http://answers.unity3d.com/questions/974036/c-lambda-call-in-for-loop-references-to-last-objec.html
lambda expressions in immediate window for VS2015
This definitely works for me, looks like when I tick either Use Managed Compatibility Mode
or Use the legacy C# and VB expression evaluators
it stops working. Ensure those are unchecked.
Why can't I use lambda expressions in the Immediate Window?
Jaredpar explained it
Why is LINQ absent from debugger windows?
Why is LINQ absent from debugger windows (Part 2)?
How to debug a Linq Lambda Expression?
You can't debug a Lambda expression if you're using a Linq to Entities provider.
But you can take a look at what SQL it translate into.
Also if you are willing to suffer a performance hit - you could load it all into Linq to obejcts - and do a Step by step
Related Topics
Appsettings Get Value from .Config File
Most Efficient Way to Insert Rows into MySQL Database
Nullable<Int> VS. Int? - Is There Any Difference
How to Ensure a Form Displays on the "Additional" Monitor in a Dual Monitor Scenario
Databindings Don't Seem to Refresh
Why Does the Contains() Operator Degrade Entity Framework's Performance So Dramatically
What Does |= (Single Pipe Equal) and &=(Single Ampersand Equal) Mean
Capture the Screen Shot Using .Net
Raise Event Thread Safely - Best Practice
Failed to Serialize the Response in Web API
How to Get the File Size in C#
How to Use Use Late Binding to Get Excel Instance
Problem Parsing Currency Text to Decimal Type
Internet Explorer Protective Mode Setting and Zoom Levels
Getting Http Status Code Number (200, 301, 404, etc.) from Httpwebrequest and Httpwebresponse
Cannot Set Some Http Headers When Using System.Net.Webrequest