WPF: Keep an eye on binding errors
8 September 2007 in .Net, Code, Windows | Comments enabled

I’m posting this because it escaped my attention initially and I’ve been meaning to post it for any other WPF developers out there who have issues with their bindings.

Whenever doing WPF development make sure that you pay attention to the “output” pane in Visual Studio (or better yet, drag the pane to a second monitor while running the application). Here you will see any errors that are occurring with your WPF bindings. You may even spot some you didn’t know were having problems.

Anybody working with WPF will be using the rich binding capabilities and I’m sure, like me, you get annoyed when things just seem to fail silently behind the scenes. Now you can see what’s really going on.

Hope that helps,

John-Daniel Trask


2 comments. Add your own comment.

Matt says 6 October 2007 @ 08:50

I am having just the problem. I am a designer and my developer has told me that my bindings are causing all sorts of grief when our application starts up and the app is running in the debugger. This appears to have no adverse effects at runtime but brings the debugger to a crawl.

I have looked into the parameters on my bindings and don’t see anything *obvious* that would need changing. It seems the bindings are firing within triggers that are not *valid* until the whole app is initialized.

Do you have any literature on where to start troubleshooting these issues?

Thanks,
Matt

traskjd says 6 October 2007 @ 12:53

Hi Matt,

I don’t have any details in particular however I believe that they really are harmless warnings. We have the same problems in our applications and we know the bindings are correct (as they function correctly once fully loaded).

It is a shame that it’s so hard to find detail about this as, like you I assume, I like to ensure what I write is as perfect as I can make it so seeing errors I can’t remove is not a good thing.

I’ve also read on several sites where people have queried this behavior and the official response from the vendors has been “ignore them, they’re harmless”.

I do know that some of the issues arise when you are accessing attached properties (such as Validation.Errors) on an element when it does not yet exist.

The errors appearing are part of standard .NET tracing functionality and you can manipulate the way the trace works which is a good and bad thing as you might be hiding information you really want. For more information about altering how WPF tracing works you might want to check out this great, albeit a bit technical, article here: http://blogs.msdn.com/mikehillberg/archive/2006/09/14/WpfTraceSources.aspx

Sorry I cannot give you a definitive answer other than to say “don’t worry, we’re all in the same boat” :-/

– JD

P.S. Things don’t look much better in .Net 3.5

Leave a Comment

Name (required)

E-mail (required - not published)

Website

Your comment: