How can I evaluate a deferred Linq statement when debugging?
Posted
by DanO
on Stack Overflow
See other posts from Stack Overflow
or by DanO
Published on 2010-04-23T22:43:21Z
Indexed on
2010/04/23
22:53 UTC
Read the original article
Hit count: 215
I'm debugging in VS2010, and I want to inspect a string value but all I can get the debugger to show me (through watches, hovering, locals, etc.) is:
"System.Linq.Enumerable+<TakeIterator>d__3a`1[System.Char]"
I don't care if there are side effects from premature evaluation or whatever, I just want to see what the expression would evaluate to if I evaluate it right now at the current breakpoint.
How is this done? Also can I change my code in such a way that it evaluates earlier? Not that I care when I'm not debugging... but just wondering.
In case it is relevant... (I doubt it.) I'm stuffing a new entity object before saving it to the database... some fields are assigned with LINQ statements, I'm not sure when they get evaluated under the covers of EF. The DB update fails with 'string or binary data would be truncated... So I'm trying to find the too-long field.
© Stack Overflow or respective owner