I performed some stress testing on Woodstock today, and found a couple of weak points in the code which prevented it from working well with absurdly large visual trees. By “absurdly large” I am referring to a visual tree with at least 10,000 elements in it. Huge, huge, huge visual trees. It should not be too often that a WPF user interface has a visual tree of that immense size, but I wanted to be sure that Woodstock can handle it well (up to a certain point).
The two performance enhancements that I addressed are:
1) Nodes in the TreeView are now loaded on-demand. When you expand a node in the TreeView it then loads the children of that node, if they are not already loaded. This drastically reduces the load time for the Woodstock window when your visual tree has thousands of items in it.
2) The children of a WpfElement are now temporarily removed from its Children property, just prior to that element being sent over to the debuggee process to be populated with property information and a snapshot image. When the freshly populated WpfElement is returned back to the visualizer its child elements are added back to its Children property. This can cut down the amount of time it takes to get the property information and snapshot for a WpfElement, especially if that element has a very large number of descendant elements.
The new bits are available here: http://www.codeproject.com/useritems/WoodstockForWPF.asp