All my view models inherit ViewModelBase. When I close some views, I want to unregister the type, so that an uncached version is instantiated upon the next request. So in my ViewModelLocator I do a Cleanup when the view is closed for these applicable views:
public static void Cleanup(ViewModelBase vm)
This fails to unregister the applicable view model. Looking at the source, I see that the method uses
(which yields ViewModelBase) to unregister the class. If it were used
the correct view model class would be returned and that works.
So I'm looking for suggestions on how to proceed forward. I can submit a pull request that changes
line 493 from
var classType = typeof(TClass);
var classType = instance.GetType();
But I'm not sure whether that will break other things.
Or I can add another overloaded Unregister() method that does the job.
Please advise, experts.