RadAutoCompleteBox Dispose

2 posts, 0 answers
  1. Matthias Bibo
    Matthias Bibo avatar
    73 posts
    Member since:
    Mar 2010

    Posted 13 Jun 2014 Link to this post


    is there a reason why the Dispose funktion of the RadAutoCompleteBox is not declared as virtual? We have implemented our own derived  Class BDLAutoCompleteBox that has its own Dispose funktion and calls the base.Dispose funktion. We need this to extend the funktionality of the Class to our specific needs. We also have a workaround in the Dipose to clear a Memory leak:
    public new void Dispose()
        this.GotFocus -= this.BdlAutoCompleteBoxGotFocus;
        this.SelectionChanged -= this.BdlAutoCompleteBoxSelectionChanged;
        this.MouseRightButtonDown -= this.BdlAutoCompleteBoxMouseRightButtonDown;
        this.MouseRightButtonUp -= this.BdlAutoCompleteBoxMouseRightButtonUp;
        if (!this.isDisposed)
                // Fix, für Telerik memory leak (SizeChanged handler des textBoxPart, wird dadurch aber nicht ganz behoben)
                Type typeAutoCompleteBox = typeof(RadAutoCompleteBox);
                System.Reflection.FieldInfo field = typeAutoCompleteBox.GetField("textBoxPart", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                if (field != null)
                    field.SetValue(this, null);
            catch (Exception)
                //TG: Only Workaround for MemoryLeak, Exceptions should not be thrown in this case
        this.isDisposed = true;

    Best Regards
  2. Vladi
    Vladi avatar
    749 posts

    Posted 16 Jun 2014 Link to this post

    Hi Matthias,

    Thank you for bringing this to our attention. We will do our best to improve the described Dispose implementation.

    We noticed that the provided code snippet solves memory leak issue in the RadAutoCompleteBox control. The corresponding issues have been resolved on our side and there is not need to resolve them in your custom inherited class.

    The mentioned fix should be available in our next official release of Telerik UI for Silverlight.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top