A developer’s view

Ramon's website

last update:

Today, I encountered a problem with WinForm’s ListView imagelist. When you assign a global imagelist to the listview, then the listview will remain in memory forever. When the ListView references other objects, then these objects won’t be collected too and you might end up with a huge memory leak. When does this occur? ListViews won’t be collected until the associated imagelist(s) is collected, when you don’t reset the SmallImageList, LargeImageList or StateImageList properties yourself.

It seems there is bug in the WPF resource architecture that can cause memory not to be released and causing performance and stability problems. The document describes when the problem occurs and why. During the development of a WPF application, we noticed that a huge amount of memory was used after a while. After profiling with the excellent .NET Memory Profiler v3.1 we found out that a lot of objects were not collected by the garbage collector.

Refactoring is a cool feature that I start using more and more. But why on Earth, doesn’t Microsoft do something about refactoring and strings? Everytime I refactor an attribute or property I am worried about my strings. Of course, I can set the option that it should also look at strings and comments, but I am worried that it might change too much (or too little). The solution for this would be very simple.

The Patient Journey Demonstrator application that I blogged about in an earlier post shows some nice new UI controls. One of the most useful new features is a “Level of Detail” slider. This slider is used in the demonstrator to specify the level of detail of the content in a listbox. Move the slider to the left and only the basic information is shown. Moving the slider to the right and more and more details are revealed.

One of the most cool features of WPF is animation. WPF has a great architecture that offers almost unlimited possibilities, but every time I wanted to animate the Height and Width properties I had problems, because the Height and Width properties are often set to the Auto value (which is internally represented as double.NaN). The DoubleAnimation class cannot deal with this value. It uses From and To properties and calculates the values in between.