Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
519
Inherited Toolbar Not Disposed
posted

Hello,

In my application (VB.Net) I use the controls of the NetAdvantage Windows Forms with customized styles.

For that, I created new controls which inherits of the original controls of Infragistics.

In the case of Infragistics.Win.UltraWinToolbars.UltraToolbarsManager, when I disposed, the method "Infragistics.Win.UltraWinToolbars.Ribbon.get_Metrics()" still references the parent form, finished in a memory leak.

Here is the code I used for create the control:

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class InheritedToolbarsManager
   Inherits Infragistics.Win.UltraWinToolbars.UltraToolbarsManager

   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
      Try
         If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
         End If
      Finally
         MyBase.Dispose(disposing)
      End Try
   End Sub


   Private components As System.ComponentModel.IContainer

   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
      CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
      CType(Me, System.ComponentModel.ISupportInitialize).EndInit()
   End Sub

End Class

I use the .NET Memory Profiler for identification of Memory Leaks:

"This instance is disposed and still indirectly rooted by an EventHandler. This often indicates that the EventHandler has not been properly removed and is a common cause of memory leaks.

The instances below are directly rooted by EventHandler(s). Investigate them to get more information about this issue."

Infragistics.Win.UltraWinToolbars.Ribbon.get_Metrics()
Infragistics.Win.UltraWinToolbars.Ribbon.OnFormCaptionChanged()
Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.OnFormTextChanged( object,EventArgs )
Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.HookFormEvents()
Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.OnFormLoad( object,EventArgs )
System.Windows.Forms.Form.OnLoad( EventArgs )

You can me help discover what is wrong in the inheritance?

Thanks