为什么WPF的数据绑定吞下异常? [英] Why does WPF databinding swallow exceptions?
问题描述
数据绑定错误本质上被吞噬,但显示在visual studio界面的OUTPUT对话框中。如果您希望获得通知(并尽可能多地控制它),那么您可以使用跟踪来源。
Bea Stollnitz提供了一个很好的写作(和一般来说调试绑定): http://www.beacosta.com/blog/? p = 52
显然,这个博客已经离职,但我们确实有WayBack机器:
http://web.archive.org/web/20091103200557/http: //www.beacosta.com/blog/?p=52
我还将其添加到我的Coding笔记本的Evernote中:
https://www.evernote.com/pub/view/sswrighton/coding/f9786746-94c3-41b5-bcd2-c12992d331a6?locale=en#st=p&n=f9786746-94c 3-41b5-bcd2-c12992d331a6
I recently wasted a lot of time trying to debug a WPF datagrid (from the WPF Toolkit). I had a column bound to a linq query with a property that was throwing an exception (in a few rows). WPF seems to catch the exception and it just makes the cells blank. I have fixed the bug causing the exception, but I would like to change WPF's behavior. I always want to know if something is wrong. Why is swallowing the exception the default behavior and how can I change it?
Databinding errors are swallowed natively, but they are displayed in the OUTPUT dialog in the visual studio interface. If you wish to be notified (and have as much control over it as possible), then you can use Trace Sources.
Bea Stollnitz provides a great writeup about this (and debuginng the bindings in general) here: http://www.beacosta.com/blog/?p=52
Apparently, this blog has departed, but we do have the WayBack Machine: http://web.archive.org/web/20091103200557/http://www.beacosta.com/blog/?p=52
I also added it to my Coding notebook for Evernote: https://www.evernote.com/pub/view/sswrighton/coding/f9786746-94c3-41b5-bcd2-c12992d331a6?locale=en#st=p&n=f9786746-94c3-41b5-bcd2-c12992d331a6
这篇关于为什么WPF的数据绑定吞下异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!