views:

810

answers:

3

Every so often I find that I have accidentally broken data binding in my application. Either by renaming a property and not renaming it in the XAML or by a property throwing an exception for some reason.

By default data binding errors are logged to debug output and exceptions that are thrown are caught and suppressed.

Is there an easy way to have an exception thrown after the debug output is logged?

I want to know as soon as possible if data binding is broken (ideally picking it up in an automated test) and not risk the chance that it might go unnoticed until tested by a human.

+2  A: 

Have a look at this blog article which may help get around this issue.

John
Exactly what I would have posted, except I couldn't remember the link...
Benjol
This is a good article about debugging problems with data bindings. But it depends on you having detected the problems in the first place right? This isn't really the answer I was after. What I want (if it is possible) is a concise description of how to make data-binding problems stand-out more in the first place.
Ashley Davis
You could create a custom trace listener that throws exceptions
John
+1  A: 
Ashley Davis
A: 

c# 4.0 dynamic approach to raising exceptions.

http://www.ontheblog.net/CMS/Home/tabid/36/EntryID/77/Default.aspx