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
165
System.ObjectDisposedException when calling Dispose on UserControl that contains a 'UltraTimelineView'.
posted

I'm upgrading an App from VS2005/v9.2 of Infragistics to VS2010/v10.1  This is an MDI app that dynamically loads user controls hosted in Ultratabs.  Because many of these user controls are "heavy" in our method called when a tab is closing we call Dispose on the user control. The code worked fine in v9.2

When I upgrade the controls to v10.1 - when we call Dispose on one of our user controls (that contains the Scheduling controls) I get the following:

System.ObjectDisposedException was unhandled by user code
  Message=Cannot access a disposed object.
Object name: 'UltraTimelineView'.
  Source=System.Windows.Forms
  ObjectName=UltraTimelineView
  StackTrace:
       at System.Windows.Forms.Control.CreateHandle()
       at System.Windows.Forms.Control.get_Handle()
       at System.Windows.Forms.Control.CreateGraphicsInternal()
       at System.Windows.Forms.Control.CreateGraphics()
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineMetricsBase.MeasureString(UltraControlBase control, String text, AppearanceData appearanceData, Boolean adjustFontData, Int32 maxWidth, StringFormat sf, TextOrientationInfo textOrientation, Boolean isPrint)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineMetricsBase.MeasureString(UltraScheduleControlBase control, String text, AppearanceData appearanceData, Boolean adjustFontData, TextOrientationInfo textOrientation)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineMetricsBase.GetHeaderSizeHelper(ITimelineControl control, List`1 strings, Size textPadding, Size imageSize, Size imagePadding, TextOrientationInfo textOrientation, AppearanceData resolvedAppearance, UIElementBorderStyle borderStyle)
       at Infragistics.Win.UltraWinSchedule.Timeline.ColumnMetrics.GetColumnHeaderSize(ITimelineControl timelineControl, DateTimeInterval interval, Size textPadding, Size imageSize, Size imagePadding, TextOrientationInfo textOrientation, AppearanceData resolvedAppearance, UIElementBorderStyle borderStyle)
       at Infragistics.Win.UltraWinSchedule.Timeline.ColumnMetrics.get_HeaderSize()
       at Infragistics.Win.UltraWinSchedule.Timeline.ColumnMetrics.get_IdealHeaderWidth()
       at Infragistics.Win.UltraWinSchedule.UltraTimelineView.get_ColumnWidthResolved()
       at Infragistics.Win.UltraWinSchedule.UltraTimelineView.Infragistics.Win.UltraWinSchedule.Timeline.ITimelineControl.get_ColumnWidthResolved()
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineMetricsBase.GetVisibleColumnCount(TimeSpan offset, Int32& firstColumnOffset, Int32& lastColumnRemainder, Double& pixelsPerMinute)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineMetricsBase.GetVisibleColumnCount(TimeSpan offset, Int32& firstColumnOffset, Int32& lastColumnRemainder)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineScrollManagerBase.get_HorizontalLargeChange()
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineScrollManagerBase.VerifyHorizontalMetrics()
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineScrollManagerBase.SynchronizeHScroll(DateTime dateTime, Boolean centerScrollThumb, Boolean fireEvent, UIAction uiAction)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineScrollManagerBase.SynchronizeHScroll(DateTime dateTime, Boolean centerScrollThumb, Boolean fireEvent)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineViewScrollManager..ctor(UltraTimelineView control)
       at Infragistics.Win.UltraWinSchedule.UltraTimelineView.get_ScrollManager()
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineViewMetrics.Dirty(DirtyMetricsContext context)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineMetricsBase.DirtyAll()
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineMetricsBase.OnCalendarInfoAttached(Object sender, CalendarInfoAttachedEventArgs e)
       at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
       at Infragistics.Win.UltraWinSchedule.UltraScheduleControlBase.OnCalendarInfoAttach(UltraCalendarInfo newInfo, UltraCalendarInfo oldInfo)
       at Infragistics.Win.UltraWinSchedule.UltraScheduleControlBase.get_CalendarInfo()
       at Infragistics.Win.UltraWinSchedule.DateTimeInterval.get_SupportsLogicalDay()
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineScrollManagerBase.VerifyForLogicalDay(UInt64& valueInMinutes, LogicalDayScrollDirectionBias bias)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineScrollManagerBase.SynchronizeHScroll(DateTime dateTime, Boolean centerScrollThumb, Boolean fireEvent, UIAction uiAction)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineScrollManagerBase.SynchronizeHScroll(DateTime dateTime, Boolean centerScrollThumb, Boolean fireEvent)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineViewScrollManager..ctor(UltraTimelineView control)
       at Infragistics.Win.UltraWinSchedule.UltraTimelineView.get_ScrollManager()
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineViewMetrics.Dirty(DirtyMetricsContext context)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineViewMetrics.OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
       at Infragistics.Win.UltraWinSchedule.Timeline.TimelineMetricsBase.OnCalendarInfoChanged(Object sender, CalendarInfoChangedEventArgs e)
       at Infragistics.Win.UltraWinSchedule.CalendarInfoChangedEventHandler.Invoke(Object sender, CalendarInfoChangedEventArgs e)
       at Infragistics.Win.UltraWinSchedule.UltraCalendarInfo.OnCalendarInfoChanged(CalendarInfoChangedEventArgs e)
       at Infragistics.Win.UltraWinSchedule.UltraCalendarInfo.FireCalendarInfoChangedEventHelper(PropChangeInfo propChangeInfo, PropertyIds propId)
       at Infragistics.Win.UltraWinSchedule.UltraCalendarInfo.OnSubObjectPropChanged(PropChangeInfo propChangeInfo)
       at Infragistics.Shared.SubObjectBase.NotifyPropChange(PropChangeInfo trigger)
       at Infragistics.Shared.SubObjectBase.NotifyPropChange(Enum propId)
       at Infragistics.Win.UltraWinSchedule.OwnersCollection.BumpVersion()
       at Infragistics.Win.UltraWinSchedule.OwnersCollection.ClearHelper(Boolean removeFromDataSource)
       at Infragistics.Win.UltraWinSchedule.OwnersDataBinding.OnDataSourceRemoved()
       at Infragistics.Win.UltraWinSchedule.DataBindingsBase.SetDataBindingHelper()
       at Infragistics.Win.UltraWinSchedule.DataBindingsBase.SetDataBinding(Object dataSource, String dataMember)
       at Infragistics.Win.UltraWinSchedule.UltraCalendarInfo.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.ComponentModel.Container.Dispose(Boolean disposing)
       at System.ComponentModel.Container.Dispose()
       at Infragistics.Win.UltraWinSchedule.UltraScheduleControlBase.Dispose(Boolean disposing)
       at Infragistics.Win.UltraWinSchedule.ControlWithActivityBase.Dispose(Boolean disposing)
       at Infragistics.Win.UltraWinSchedule.UltraMonthViewSingleBase.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
       at Abbott.ADD.CMSNext.UIControls.BaseControl.Dispose(Boolean disposing) in c:\abbott\CMSNext\Nirvana_3.0\CMSNext2010\UIControls\ucBaseControl.Designer.cs:line 20
       at Abbott.ADD.CMSNext.UIControls.Dispatch.Dispose(Boolean disposing) in c:\abbott\CMSNext\Nirvana_3.0\CMSNext2010\UIControls\ucDispatch.Designer.cs:line 20
       at System.ComponentModel.Component.Dispose()
       at Abbott.ADD.CMSNext.Windows.MDIController.RemoveTabObject(UltraTab tab) in c:\abbott\CMSNext\Nirvana_3.0\CMSNext2010\CMSNext\clsMDiController.cs:line 853
       at Abbott.ADD.CMSNext.Windows.frmCMSNext.utCMSNextTab_TabClosing(Object sender, TabClosingEventArgs e) in C:\abbott\CMSNext\Nirvana_3.0\CMSNext2010\CMSNext\frmCMSNext.cs:line 1087
       at Infragistics.Win.UltraWinTabControl.UltraTabControlBase.OnTabClosing(TabClosingEventArgs e)
       at Infragistics.Win.UltraWinTabControl.UltraTabControlBase.RaiseEvent(UltraTabControlEventId id, EventArgs e)
       at Infragistics.Win.UltraWinTabControl.UltraTab.Close(TabCloseReason reason)
       at Infragistics.Win.UltraWinTabControl.UltraTabControlBase.TabControlTabManager.CloseButtonClick(ITabItem tab, TabCloseReason reason)
       at Infragistics.Win.UltraWinTabs.TabCloseButtonUIElement.ButtonClick()
       at Infragistics.Win.ButtonUIElementBase.OnClick()
       at Infragistics.Win.ControlUIElementBase.ProcessMouseUpHelper(Object sender, MouseEventArgs e)
       at Infragistics.Win.ControlUIElementBase.ProcessMouseUp(Object sender, MouseEventArgs e)
       at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
       at Infragistics.Win.UltraControlBase.OnMouseUp(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  InnerException:

  • 69832
    Offline posted

    That looks like a bug in UltraTimelineView. You might want to report it so that you receive a notification when the fix becomes available. In the meantime you might be able to work around it by handling the control's Disposed event and setting its CalendarInfo property to null.