WPF CollectionView can leak memory

A time ago I wrote about using collection views in WPF to achieve different looks at the same source collection. By creating different instances of ListCollectionView we could have the collection displayed in different sorting, ordering and grouping shape. Unfortunately there is small trap when using collection views. CollectionView class instantiated with a source collection t…

By Mirek on (tags: CollectionView, memory leak, WPF, categories: code)

Memory leak by misusing Autofac

Recently I’ve found out that we can easily cause a memory leaks in our .net application by improper usage of the dependency injection container Autofac. The case of this problem concerns only components that implements IDisposable interface, so are meant to handle some unmanaged resources and need to be disposed when no longer needed. Let me show you how to reproduce this probl…

By Mirek on (tags: Autofac, IDisposable, memory leak, categories: code)

Memory leak using PropertyDescriptor AddValueChanged

Recently I found out that my attached property, which I am using to modify the dependency property of one of my controls, causes a memory leak. Finally it turned out that it is not the attached property, but the titled method of PropertyDescriptor I have used in my code. The AddValueChanged method allows to monitor changes on any dependency property of a component. In my case I…

By Mirek on (tags: memory leak, WPF, categories: code)