1320
ArgumentOutOfRangeException with UltraChart control as Gantt Chart
posted

Greetings.

 I am having a problem with the UltraChart control that is beyond my abilities to resolve.  I am creating this post in hope that someone may set me on the right path.

I have built a custom windows control that employs a number of sub-controls in its design – including one each of an Infragistics UltraGrid and UltraChart control.  The image below shows my “Scheduler” control beneath an UltraListView control in Details view. 

The scheduler control pretty much consists of an UltraGrid control on the left and an UltraChart control on the right.   Other controls are used for showing and controlling visible date and time range selection.  As can be seen the UltraChart is being shown as a Gantt chart, and I am making use of the UltraGridBand.SortColumnsCollection to achieve a tree-view style of display in the UltraGrid.

The scheduler control displays a hierarchy of objects with time entries.  In the example above, as a different Document is selected in the Document List the hierarchy of its Phases and Performers (and their time entries) are displayed in the scheduler control below.  A lot of complex coding has been written to ensure that the two controls are kept in synchronization.  For example if an UltraGroupByRow is collapsed in the UltraGrid then the UltraChart GanttSeries related to that row is hidden.

The problem that I am having is that occasionally, after having selected different documents, an error is thrown when the mouse cursor is moved over the UltraChart control.  The error is an ArgumentOutOfRangeException with the message “Index was out of range. Must be non-negative and less than the size of the collection”.  The stack trace when the error is thrown is given below:

   at System.Collections.ArrayList.get_Item(Int32 index)
   at System.Collections.Specialized.StringCollection.get_Item(Int32 index)
   at Infragistics.UltraChart.Data.GanttSeriesCollection.get_Item(Int32 index)
   at Infragistics.UltraChart.Core.ChartCore.GetChartInfoFromPrimitive(Primitive prim)
   at Infragistics.Win.UltraWinChart.DefaultTool.ProcessMouseMove()
   at Infragistics.Win.UltraWinChart.DefaultTool.MouseMove()
   at Infragistics.Win.UltraWinChart.UltraChart.OnMouseMove(MouseEventArgs evt)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.UserControl.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)

As you can see none of my code is being run when the error is thrown thus I am unable to work out exactly where or why the error is occurring.  I have reviewed my code extensively to ensure that I am not maintaining any references to primitives that should otherwise have been disposed, there I am at a loss as to how to overcome this error.  Yes I am using a MouseDownTool for managing the dragging of time entries which is based on the InteractionTool  but I cannot see any code within that class which could cause this error.

I have tried in vain to create a demo program which reproduces the error.  Furthermore, due to the software pre-requisites of my program I am unable to distribute it for testing in its own right.

Is anyone able to help me please?

Thanks, Tony.