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
535
IndexOutOfRangeException when using spreadsheet
posted

Hi,

Some users have reported this kind of exception when using our software component which is built on XamSpreadsheet. I have not managed to reproduce this exception, but I think it's related to scrolling.

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Infragistics.Collections.MDList`1.get_Item(Int32 row, Int32 column)
at Infragistics.Controls.Grids.Core.ExcelSheetPaneManager.VerifyPaneInfoImpl()
at Infragistics.Controls.Grids.Core.ExcelSheetPaneManager.VerifyPaneInfo()
at Infragistics.Controls.Grids.Core.ExcelSheetPaneManager.Measure(Size availableSize)
at Infragistics.Controls.Grids.Core.SpreadsheetAreaLayoutManager.Measure(Size availableSize)
at Infragistics.Controls.Grids.Primitives.WpfSpreadsheetAreaLayoutManager.Measure(Size availableSize)
at Infragistics.Controls.Grids.Primitives.SpreadsheetLayoutPanel.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at Desktop.App.Main() 

Can you give any advice what might be causing this?

Thanks,

-Antti

Parents
  • 1530
    posted

    Hi Antti,

    A wild guess would be that they are using a parameterless constructor of the Workbook class

    xamSpreadSheet1.Workbook = new Workbook();

     and the default file format for the Workbook class is Excel97To2003 (i.e. xls file format). Xls only supports 256 columns and 65536 rows, so I guess they perform some interactions with the last column(256)  which causes the control to call the VerifyPaneInfo, but can't be sure until you can provide an isolated sample which reproduces the behavior. So if you want the new format xlsx limits, which are 16384 columns and 1048576 rows then you would have to use an overload of the Workbook constructor that takes a WorkbookFormat e.g.:
    xamSpreadSheet1.Workbook = new Workbook(WorkbookFormat.Excel2007);

    But it will be best if you could provide us a sample where the issue is reproducible in order to investigate it further.

    You can also try to update to our latest service release and see whether you will continue receiving this exception.

    Sincerely,
    Teodor Tenev
    Software Developer

Reply Children
No Data