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
635
UltraWinGrid exception while adding items to its databound list
posted

Hello all,

I've got an UltraWinGrid that's data-bound to a BindingSource:

bindingSource.DataSource = new List<MyDataObject>();
ultraGrid1.DataSource = bindingSource;

After I add (866) items to the list using a background worker thread:

foreach (var item in itemsList)
{
 bindingSource.DataSource.Add(item);
}

I get the exception below. It doesn't happen with any consistency. Sometimes it works just fine. Any ideas what's going on?

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at Infragistics.Shared.SparseArray.CopyToHelper(Node n, Array array, Int32& index)
   at Infragistics.Shared.SparseArray.CopyToHelper(Node n, Array array, Int32& index)
   at Infragistics.Shared.SparseArray.CopyToHelper(Node n, Array array, Int32& index)
   at Infragistics.Shared.SparseArray.CopyTo(Array array, Int32 index, ICreateItemCallback callback)
   at Infragistics.Shared.SparseArray.ToArray(Type type)
   at Infragistics.Win.UltraWinGrid.RowsCollection.RowsSparseArray.ToArray(Boolean create, Boolean syncWithSortedSparseArray, Boolean dontFireInitializeRowOnNewRows)
   at Infragistics.Win.UltraWinGrid.RowsCollection.InitNonGroupByRows(IList fireInitializeRowOnTheseRows)
   at Infragistics.Win.UltraWinGrid.RowsCollection.SyncRowsHelper(IList boundList)
   at Infragistics.Win.UltraWinGrid.RowsCollection.SyncRows()
   at Infragistics.Win.UltraWinGrid.RowsCollection.VerifyGroupByVersionHelper()
   at Infragistics.Win.UltraWinGrid.UltraGridRow.get_ParentRow()
   at Infragistics.Win.UltraWinGrid.UltraGridRow.get_HiddenResolved()
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.get_FirstRow()
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.GetMaxScrollPosition(Boolean scrollToFill)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.EnsureScrollRegionFilled(Boolean calledFromRegenerateVisibleRows)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows(Boolean resetScrollInfo)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.WillScrollbarBeShown(ScrollbarVisibility assumeColScrollbarsVisible)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.PositionScrollbar(Boolean resetScrollInfo)
   at Infragistics.Win.UltraWinGrid.ScrollRegionBase.SetOriginAndExtent(Int32 origin, Int32 extent)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.SetOriginAndExtent(Int32 origin, Int32 extent)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.ResizeRowScrollRegions()
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.PositionChildElements()
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.set_Rect(Rectangle value)
   at Infragistics.Win.UltraWinGrid.UltraGridUIElement.PositionChildElements()
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
   at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics)
   at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   at Infragistics.Win.UltraWinGrid.UltraGridUIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)
   at Infragistics.Win.UltraWinGrid.UltraGrid.OnPaint(PaintEventArgs pe)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   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)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
    CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
SmartSignal.Com.EPICenter.Joust.UI
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/SmartSignal.Com.EPICenter.Joust.UI.exe
----------------------------------------
SmartSignal.Service.Contract
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.0.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/SmartSignal.Service.Contract.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
SmartSignal.Com.EPICenter.Joust.Core
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/SmartSignal.Com.EPICenter.Joust.Core.DLL
----------------------------------------
SmartSignal.Client.Helper
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.0.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/SmartSignal.Client.Helper.DLL
----------------------------------------
log4net
    Assembly Version: 1.2.10.0
    Win32 Version: 1.2.10.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/log4net.DLL
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Core
    Assembly Version: 3.5.0.0
    Win32 Version: 3.5.30729.1 built by: SP
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
SmartSignal.Common
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.0.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/SmartSignal.Common.DLL
----------------------------------------
SmartSignal.Client.Tray
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.0.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/SmartSignal.Client.Tray.EXE
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.4506.2152 (SP.030729-0100)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Serialization/3.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
SMDiagnostics
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.4506.2152 (SP.030729-0100)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/SMDiagnostics/3.0.0.0__b77a5c561934e089/SMDiagnostics.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
SmartSignal.Client.Control
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.0.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/SmartSignal.Client.Control.DLL
----------------------------------------
SmartSignal.Service.Common
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.0.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/SmartSignal.Service.Common.DLL
----------------------------------------
Infragistics2.Win.v8.3
    Assembly Version: 8.3.20083.1009
    Win32 Version: 8.3.20083.1009
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Infragistics2.Win.v8.3/8.3.20083.1009__7dd5c3163f2cd0cb/Infragistics2.Win.v8.3.dll
----------------------------------------
Infragistics2.Win.UltraWinTabControl.v8.3
    Assembly Version: 8.3.20083.1009
    Win32 Version: 8.3.20083.1009
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Infragistics2.Win.UltraWinTabControl.v8.3/8.3.20083.1009__7dd5c3163f2cd0cb/Infragistics2.Win.UltraWinTabControl.v8.3.dll
----------------------------------------
Infragistics2.Shared.v8.3
    Assembly Version: 8.3.20083.1009
    Win32 Version: 8.3.20083.1009
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Infragistics2.Shared.v8.3/8.3.20083.1009__7dd5c3163f2cd0cb/Infragistics2.Shared.v8.3.dll
----------------------------------------
SmartSignal.Com.EPICenter.Joust.Data
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/SmartSignal.Com.EPICenter.Joust.Data.DLL
----------------------------------------
SmartSignal.Com.EPICenter.Joust.Controls
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/DevSSC/SmartSignal/Main/source/Projects/Joust/bin/SmartSignal.Com.EPICenter.Joust.Controls.DLL
----------------------------------------
System.ServiceModel
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.4506.2254 (QFE.030729-1900)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.ServiceModel/3.0.0.0__b77a5c561934e089/System.ServiceModel.dll
----------------------------------------
System.IdentityModel
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.4506.2152 (SP.030729-0100)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.IdentityModel/3.0.0.0__b77a5c561934e089/System.IdentityModel.dll
----------------------------------------
System.Web
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
System.WorkflowServices
    Assembly Version: 3.5.0.0
    Win32 Version: 3.5.594.1152
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.WorkflowServices/3.5.0.0__31bf3856ad364e35/System.WorkflowServices.dll
----------------------------------------
System.ServiceModel.Web
    Assembly Version: 3.5.0.0
    Win32 Version: 3.5.594.1152
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.ServiceModel.Web/3.5.0.0__31bf3856ad364e35/System.ServiceModel.Web.dll
----------------------------------------
Microsoft.VisualStudio.Diagnostics.ServiceModelSink
    Assembly Version: 3.0.0.0
    Win32 Version: 9.0.21022.8
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Diagnostics.ServiceModelSink/3.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll
----------------------------------------
System.IdentityModel.Selectors
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.4506.2152
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.IdentityModel.Selectors/3.0.0.0__b77a5c561934e089/System.IdentityModel.Selectors.dll
----------------------------------------
Infragistics2.Win.UltraWinDock.v8.3
    Assembly Version: 8.3.20083.1009
    Win32 Version: 8.3.20083.1009
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Infragistics2.Win.UltraWinDock.v8.3/8.3.20083.1009__7dd5c3163f2cd0cb/Infragistics2.Win.UltraWinDock.v8.3.dll
----------------------------------------
Infragistics2.Win.UltraWinTree.v8.3
    Assembly Version: 8.3.20083.1009
    Win32 Version: 8.3.20083.1009
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Infragistics2.Win.UltraWinTree.v8.3/8.3.20083.1009__7dd5c3163f2cd0cb/Infragistics2.Win.UltraWinTree.v8.3.dll
----------------------------------------
Infragistics2.Win.Misc.v8.3
    Assembly Version: 8.3.20083.1009
    Win32 Version: 8.3.20083.1009
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Infragistics2.Win.Misc.v8.3/8.3.20083.1009__7dd5c3163f2cd0cb/Infragistics2.Win.Misc.v8.3.dll
----------------------------------------
Infragistics2.Win.UltraWinEditors.v8.3
    Assembly Version: 8.3.20083.1009
    Win32 Version: 8.3.20083.1009
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Infragistics2.Win.UltraWinEditors.v8.3/8.3.20083.1009__7dd5c3163f2cd0cb/Infragistics2.Win.UltraWinEditors.v8.3.dll
----------------------------------------
Infragistics2.Win.UltraWinGrid.v8.3
    Assembly Version: 8.3.20083.1009
    Win32 Version: 8.3.20083.1009
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Infragistics2.Win.UltraWinGrid.v8.3/8.3.20083.1009__7dd5c3163f2cd0cb/Infragistics2.Win.UltraWinGrid.v8.3.dll
----------------------------------------
Infragistics2.Win.UltraWinGrid.ExcelExport.v8.3
    Assembly Version: 8.3.20083.1009
    Win32 Version: 8.3.20083.1009
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Infragistics2.Win.UltraWinGrid.ExcelExport.v8.3/8.3.20083.1009__7dd5c3163f2cd0cb/Infragistics2.Win.UltraWinGrid.ExcelExport.v8.3.dll
----------------------------------------
Infragistics2.Excel.v8.3
    Assembly Version: 8.3.20083.1009
    Win32 Version: 8.3.20083.1009
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Infragistics2.Excel.v8.3/8.3.20083.1009__7dd5c3163f2cd0cb/Infragistics2.Excel.v8.3.dll
----------------------------------------
System.Design
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Design/2.0.0.0__b03f5f7f11d50a3a/System.Design.dll
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Parents
  • 37774
    Verified Answer
    posted

    You need to make sure that you marshal any asynchronous calls back to the main UI thread when dealing with anything that could affect the UI; this is true of all UI aspects in .NET, as far as I am aware.  The fact that this doesn't always happen at the same time is a classic symptom of a threading issue.  In this case, you're updating the data source, which is then sending a notification to the grid that it has changed; the grid will respond to this by asking for the value and updating itself, so you are indirectly affecting the UI from another thread.

    -Matt

Reply Children