Unplanned
Last Updated: 31 Oct 2018 08:06 by ADMIN
ADMIN
Kalin
Created on: 15 Mar 2017 09:21
Category: RichTextBox
Type: Bug Report
1
RichTextBox: Memory leak related to ContextMenu
ContextMenu holds a reference to last RadRichTextBox it's shown for. Since ContextMenu is cached by MEF, this leads to memory leak. 

Workaround: There are two options:

- manually set different instances of ContextMenu to all your RadRichTextBox-es
this.radRichTextBox.ContextMenu = new Telerik.Windows.Controls.RichTextBoxUI.ContextMenu();

- Create custom context menu that will be non-sharable. MEF will automatically load different instances of it for all RadRichTextBoxes on demand:
[PartCreationPolicy(CreationPolicy.NonShared)]
[CustomContextMenu]
public class NonSharedContextMenu : ContextMenu
{
}

Using any of the options will prevent MEF from creating cached instance of the ContextMenu.
0 comments