调试时如何评估延迟的Linq语句? [英] How can I evaluate a deferred Linq statement when debugging?

查看:113
本文介绍了调试时如何评估延迟的Linq语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试VS2010,我想检查一个字符串值,但是我可以让调试器显示(通过手表,盘旋,本地等)是:

 System.Linq.Enumerable +< TakeIterator> d__3a`1 [System.Char]

我不在乎是否有过早评估的副作用或什么,我只是想看看表达式将如何评估,如果我现在评估当前断点。



这样做如何?我也可以改变我的代码,以便早期评估?不,我不在乎,当我不调试...但只是想知道。


如果它是相关的...(我怀疑)我在填充一个新的
实体对象,然后将
保存到数据库中...某些字段分配了LINQ语句,我不知道什么时候在EF的封面下进行评估。数据库更新失败,字符串或二进制数据将被截断...所以我试图找到太长的字段。



解决方案

截图http://i44.tinypic.com/25k311h.png






你不小心这样做可能吗?



屏幕截图http://i40.tinypic。 com / o01mkw.png


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.

解决方案

Screenshot http://i44.tinypic.com/25k311h.png


Are you accidentally doing something like this perhaps?

Screenshot http://i40.tinypic.com/o01mkw.png

这篇关于调试时如何评估延迟的Linq语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆