We have an issue in our product with ViewModels hanging around, and using dotMemory I continually see that it appears that tool tips in the ribbon are holding onto things.
I have a sample project where I've managed to repeat the issue. The project has a simple ribbon with a few buttons. The RunRiskAnalysis button is a mock up of one of the buttons in our actual projects ribbon (with bindings and resources taken out).
Steps I take to repeat;
It doesn't happen 100% of the time but happens very frequently..What I see is that when I hover over the RunRiskAnalysis button for the first time I see a jump in unmanaged memory, but I don't think this is related. After I hit the Change DataContext button a few times I see the managed memory go up and not come back down.
Comparing the first and last snapshot I can see there are two instances of my VIewModel when there should only be one.
When I investigate the surviving object I can see that it is being retained by the tool tip. Here are a couple retention paths from a couple different times repeating the issue.
Our product is using 13.1 but I've repeated in our product and in the sample using the latest (23.1)I tried attaching the sample project but it was too big to attach. Let me know where I can send it.
Please delete the bin folder from your project to reduce the project size and try to attach it here again. Since V13.1 is no longer supported i would run/test the sample against latest supported version and if find the memory leak then i would log it to get it fix in the latest supported version . and in order to apply fix patch you would have to upgrade your projects to latest.
Infragistics WPF Ribbon Memory Leak.zip
You'll need to put the following in the Referenced Assemblies folder:
I tried to run your sample and I dont have your ribbonControlLibrary reference in the sample hence getting this error .
Is there something i can do about it ?
Here you go. It is a Microsoft provided ribbon library for WPF.RibbonControlsLibrary.zip
I included the dl, sample build successfully then i run it and its crashing with this error :
FileNotFoundException: Could not load file or assembly 'Microsoft.Windows.Shell, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified