Last Updated: 26 Aug 2013 11:33 by ADMIN
Created on: 25 Jul 2013 06:46
Type: Bug Report
WPF Memory leak when trying to test modal dialogs.
WPF Memory leak when trying to test modal dialogs.

When you try to open/close dialog window with testing framework it cause memory leak and child dialog not garbage collected. We do it in loop and for some iteration Telerik testing framework can't find dialog and break by timeout. 
We found it with windbg + sos dll. Results:

Scan Thread 14 OSTHread 25bc
DOMAIN(006A72D0):HANDLE(Pinned):1513e4:Root:  039593f8(System.Object[])->
  029ccf78(System.Collections.Generic.Dictionary`2[[System.IntPtr, mscorlib],[Telerik.TestingFramework.WpfExtension.WpfCommunication, Telerik.TestingFramework.WpfExtension]])->
  02a5650c(System.Collections.Generic.Dictionary`2+Entry[[System.IntPtr, mscorlib],[Telerik.TestingFramework.WpfExtension.WpfCommunication, Telerik.TestingFramework.WpfExtension]][])->

It seems that some static dictionary is referenced to ChildWindow which cause memory leak.  It seems that problem in WpfCommunicationEntryPoint.Comms. I found only one static dictionary with this signature (problem can be in another place).

How to use windbg + sos.dll:
0. Run test from VS MemoryLeakSmokeTestFixture.MemoryLeak_TelericFramework
1. Run windbg 
2. File->Attach to process-> choose MainApplication
3. Load sos.dll : .loadby sos clr
4. Fild objects: !DumpHeap -type ChildWindow
5. Find who are referenced to it: !gcroot OneOfTheIntancesAdresses. 
 You are going to see the same results.

Sample project in attach

Thank you.
Looking for advice
Attached Files:
Konstantin Petkov
Posted on: 26 Aug 2013 11:33
Hi Yurii,

I would like to Thank you on behalf of the development team for your efforts in helping us isolate the tough problem in the core of our product.

Best Regards!
Posted on: 22 Aug 2013 19:31
Thats great. Thanks :)
Posted on: 19 Aug 2013 11:06
The memory leak will be fixed in our next official release.
Posted on: 09 Aug 2013 13:10
Could you give any advice or workaround for this?
Posted on: 02 Aug 2013 10:44
I checked it with sos.dll and sosex.dll tool (!mdt command)  and can say definitely that problem is in Telerik.TestingFramework.WpfExtension.WpfCommunicationEntryPoint class and its Comm static field.