MEF keeps reference of NonShared IDisposable parts, not allowing them to be collected by GC
问题 I've encountered somewhat of a problem in MEF's part lifetime which causes memory leaks in my Prism application. My application exports views and viewmodels with the PartCreationPolicy being set to CreationPolicy.NonShared . The views and viewmodels inherit from ViewBase and ViewModelBase respectively, which implements IDisposable . Now, since my parts implement IDisposable , a reference to them is kept by the container, which causes them to not be released by the garbage collector. According