We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DockingManager does not really delete objects even doing the Children.Remove


I am using the dockingManager and in one of its ContentControls I have loaded a Frame that has as a content a Page object with a WebView2 (Microsoft.Web.WebView2) playing a YouTube video. This works correctly. The problem is that if I close the panel and in the "DockingManager_DockStateChanged" event, I do a "dockingManager.Children.Remove(sender)", everything seems to be going well, the panel disappears and the dockingManager childrens count is one less, but I can still hear the audio from the youtube video. This means that the video is playing in the background so the webView2 control still exists and the object hasn't actually been removed from memory and from the dockingManager.

What am I doing wrong? Why isn't the panel actually removed and the memory released?

Thanks in advance.

3 Replies 1 reply marked as answer

BA BagavathiPerumal Apranandham Syncfusion Team March 28, 2023 03:27 PM UTC

Hi Urtzi,

We were able to reproduce the reported issue from our end. After investigating, we found that the same behavior is present in the Microsoft TabControl. To prevent the issue with background audio playing, we recommend that you pause the video before closing the dock item. Please refer to the attached sample for your reference.

Bagavathi Perumal A

Attachment: DockingManagerSample_6f4376e.zip

UR Urtzi March 29, 2023 05:52 PM UTC


The problem is that I don't have control over the users of the application and I don't know what actions our clients are going to perform. They will simply close the panel (is the intuitive use) and they will find the problem. To avoid it, in the "DockingManager_DockStateChanged" event, I have accessed the "Page" of its content and call to the Dispose() of the WebView2. In this way the sound stops.

What worries me about all of this is if the DockingManager control is actually removing the controls from the removed panels and freeing up memory or this is no happening even though I do Children.Remove(sender). If the audio sounds, it means that it is in memory. Who assures me that when users have been opening and closing DockingManager´s panels for hours (I have more than 60 different types of panels that users can load, with different controls within each one, so the Dispose() solution is not viable for all cases) do not end up having performance problems until the application crashes?

Thank you.

BA BagavathiPerumal Apranandham Syncfusion Team March 30, 2023 02:38 PM UTC

Hi Urtzi,

As mentioned earlier, this same behavior can also be observed in the MS TabControl. It's uncertain whether this behavior indicates a memory leak issue. The Memory leak can be identified by using the Memory profiler results.

Bagavathi Perumal A

Marked as answer
Live Chat Icon For mobile
Up arrow icon