Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging WPF : Tools and Techniques

Ok, so I just wasted an hour hunting why my lookless WPF control wasn't showing up in the Window.

Eventually, i traced it to the fact that I forgot to add the ResourceDictionary entry in the generic.xaml file under the themes directory. The style and the class itself was OK.

Is there a way to trace what is going on inside WPF? How to trace how a style gets loaded (or NOT loaded). I imagine that must become a huge stack of stuff to look at, but there has got to be better than having to check each and every file for typos or stuff i forgot.

(I've searched for other questions but there's mostly for a specific case)

Thanks!

like image 426
moogs Avatar asked Feb 11 '10 14:02

moogs


People also ask

How do I debug a binding in WPF?

For WPF in . NET Framework, data binding failures must be shown in the debug output for the XAML Binding Failures pane to detect and show them. The option for this is in the Tools > Options > Debugging > Output Window > WPF Trace Settings dialog.


2 Answers

This may not help with your particular problem, but Snoop is a great tool for debugging WPF applications.

This is also a bit unrelated to the issue you mentioned, but I've also found that you need to keep an eye on memory usage when working with WPF (especially when you're getting started), since it's pretty easy to keep unintended references to objects. Red Gate's memory profiler is an amazing tool for this.

like image 152
IV. Avatar answered Sep 19 '22 15:09

IV.


Well, there is nothing as sophisticated as debugging a c# code in visual studio, but there are a few ways;

http://rrelyea.spaces.live.com/Blog/cns!167AD7A5AB58D5FE!1625.entry http://geekswithblogs.net/lbugnion/archive/2007/03/14/108728.aspx http://blogs.devsource.com/devlife/content/silverlight/debugging_dynamic_xaml_in_silverlight_1.html

like image 28
Faisal Avatar answered Sep 21 '22 15:09

Faisal