为什么WPF绑定吞下例外?绑定、吞下、WPF

2023-09-02 01:46:18 作者:浪痞孤王

最近我浪费了很多时间试图(从WPF工具包)调试WPF数据网格。我必然要与被抛出异常(在几行)的属性LINQ查询列。 WPF似乎捕捉到了异常,它只是使细胞空白。我有固定导致异常的bug,但我想改变WPF的行为。我总是想知道,如果事情是错的。为什么吞咽异常的默认行为,我该怎么改变呢?

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.

衣Stollnitz提供了有关这个伟大的书面记录(以及debuginng一般绑定)位置: HTTP :?//www.beacosta.com/blog/ P = 52

Bea Stollnitz provides a great writeup about this (and debuginng the bindings in general) here: http://www.beacosta.com/blog/?p=52

显然,这个博客已经离开,但我们有Wayback机器: HTTP://web.archive。组织/网络/ 20091103200557 / 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

我也把它添加到我的编码笔记本Evernote的: https://www.evernote.com/pub/view/sswrighton/coding/f9786746-94c3-41b5-bcd2-c12992d331a6?locale=en#st=p&n=f9786746-94c3-41b5-bcd2-c12992d331a6

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