Posted 9 October 2025, 3:17 pm EST
Hello support! We have recently had a couple of users report an issue that we cannot reproduce but they can and we were hoping you could provide a little guidance as to possible causes? It involves C1.Win.C1FlexGrid version 4.8.20241.664. IN the form we are rebuilding the grid each time the user clicks on a row of a treeview control. It seems they can do this a couple of times but at some point they get this error:
System.InvalidOperationException: Failed to compare two elements in the array. —> System.ArgumentException: Object must be of type Int32.
at System.Int32.CompareTo(Object value)
at System.Array.BinarySearch(Array array, Int32 index, Int32 length, Object value, IComparer comparer)
— End of inner exception stack trace —
at System.Array.BinarySearch(Array array, Int32 index, Int32 length, Object value, IComparer comparer)
at System.Collections.SortedList.IndexOfKey(Object key)
at System.Collections.SortedList.Contains(Object key)
at ax.w(Int32 a, Int32 b)
at ax.cd(Int32 a, Int32 b, Image& c, CheckEnum& d)
at C1.Win.C1FlexGrid.C1FlexGridBase.DrawCell(PaintEventArgs e, Int32 row, Int32 col, DrawColorMode colorMode)
at C1.Win.C1FlexGrid.C1FlexGrid.DrawCell(PaintEventArgs e, Int32 row, Int32 col, DrawColorMode colorMode)
at C1.Win.C1FlexGrid.C1FlexGrid.DrawRow(PaintEventArgs e, Int32 row, DrawColorMode colorMode)
at C1.Win.C1FlexGrid.C1FlexGridBase.dj(PaintEventArgs a, DrawColorMode b)
at C1.Win.C1FlexGrid.C1FlexGridBase.OnPaint(PaintEventArgs e)
at AdvancedSoftwareDesigns.Windows.Forms.FlexGrid._onPaint(PaintEventArgs e) in C:\VS2015\ProductVision 5.2\Build 5.4.1003.11\ASD Libraries\AdvancedSoftwareDesigns.Windows.Forms\Windows\Forms\FlexGrid.vb:line 1150
at AdvancedSoftwareDesigns.Windows.Forms.FlexGrid.OnPaint(PaintEventArgs e) in C:\VS2015\ProductVision 5.2\Build 5.4.1003.11\ASD Libraries\AdvancedSoftwareDesigns.Windows.Forms\Windows\Forms\FlexGrid.vb:line 1176
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl.WndProc(Message& m)
at C1.Win.C1FlexGrid.C1FlexGridBase.WndProc(Message& m)
at AdvancedSoftwareDesigns.Windows.Forms.FlexGrid.WndProc(Message& m) in C:\VS2015\ProductVision 5.2\Build 5.4.1003.11\ASD Libraries\AdvancedSoftwareDesigns.Windows.Forms\Windows\Forms\FlexGrid.vb:line 433
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
The grid has about a dozen columns, mostly boolean and like I say it paints fine a couple of times for them but then throws this error when they next click a row in the treeview and we rebuild the grid. We cannot reproduce it in a debugger. One user has a laptop which throws the error and cannot reproduce on a desktop so maybe hardware related???
Any guidance would be appreciated. Thanks!

