I just spend ~3 hours trying to find out why my error reporting system doesn't work. The situation was simple, I wanted to have a tree view that display the structure of an XML document, and show an error icon if there are any schema errors. The idea was that the error would propogate up, so an error in any child would show in the parent, and the grandparent, etc.
But I couldn't get that to work. I debugged it endlessly, I made a lot of changes (some of them were even neccesary :-) ) in order to find out what the problem was. In the end, I verified that it work if I'm changing the text of the TreeNode it does propogate up. But it didn't work if I was using the icons.
Then I did something very simple, I moved the selection from the root to the second node, and the icon has changed! Apperantly the problem was that if you define an ImageList for a tree, you get 1+1, a selected image. That was my problem, both the selected image and the okay image were the same, and that was what was causing the whole problem.
It get weirder, you can't disable the SelectedImageIndex, and I'm not sure if this is the framework fault or VS.Net. I ended up with a SetImageIndex() method that set for both of them at once. Yuck!