This is a migrated thread and some comments may be shown as answers.

Index was out of range. Must be non-negative and less than the size of the collection.

1 Answer 334 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 01 Feb 2012, 11:56 PM
I upgraded the Telerik Reporting library for my WinForms project due to a bug in Q1 2009 Reporting.  I upgraded to Q3 2011 and recompiled.  If I revert to the older DLL, the report displays as expected.

I get the following error:

System.ArgumentOutOfRangeException was unhandled
  Message="Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"
  Source="mscorlib"
  ParamName="index"
  StackTrace:
       at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
       at System.ThrowHelper.ThrowArgumentOutOfRangeException()
       at System.Collections.Generic.List`1.get_Item(Int32 index)
       at Telerik.ReportViewer.WinForms.InteractivePageLayout.DrawPages(Graphics graphics, Rectangle rectangle, Int32 index)
       at Telerik.ReportViewer.WinForms.WinViewer.OnPaint(PaintEventArgs eventArgs)
       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.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at Telerik.WinControls.SafeNativeMethods.RedrawWindow(IntPtr hWnd, IntPtr rectUpdate, IntPtr hRgnUpdate, UInt32 uFlags)
       at Telerik.WinControls.UI.ThemedFormBehavior.RefreshNC()
       at Telerik.WinControls.UI.ThemedFormBehavior.OnWMNCActivate(Message& m)
       at Telerik.WinControls.UI.ThemedFormBehavior.HandleWndProc(Message& m)
       at Telerik.WinControls.UI.RadFormBehavior.HandleWndProc(Message& m)
       at Telerik.WinControls.UI.RadFormControlBase.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.Show()
       at ColonialFence.ChainLinkOrderForm.radButtonPrint_Click(Object sender, EventArgs e) in C:\Users\Peter\Documents\Visual Studio 2008\Projects\ColonialFence\ColonialFence\ChainLinkOrderForm.cs:line 203
       at Telerik.WinControls.RadItem.OnClick(EventArgs e)
       at Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e)
       at Telerik.WinControls.RadItem.DoClick(EventArgs e)
       at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
       at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e)
       at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
       at Telerik.WinControls.RadControl.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.ScrollableControl.WndProc(Message& m)
       at Telerik.WinControls.RadControl.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at ColonialFence.Program.Main() in C:\Users\Peter\Documents\Visual Studio 2008\Projects\ColonialFence\ColonialFence\Program.cs:line 291
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at System.Activator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Here's the line of code where it fails:

  private void radButtonPrint_Click(object sender, EventArgs e)
        {
            Program.PrintForms.Category = Program.Category.CHAINLINK;
            Program.fPrint = new PrintForm();
            Program.fPrint.Show();                        <-----------------------------  fails on the Show() method
        }

Please let me know what I need to do.  I was told there was a bug (by Telerik) in Reporting Q1 2009 as it relates to 64-bit Windows and that I needed to upgrade to fix it.  Now this!   Please help!

Thanks,

Peter Mello

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 02 Feb 2012, 02:39 PM
Hi Peter,

The problem with the Q1 2009 version that you reported is not related to 64 bit OS. Please review our answer in your other thread for more info on that.
About the problem in this post, we have not encountered it so far and would appreciate if you post steps to reproduce it or provide a sample that exhibits it. In Q3 2011 we introduced an Interactive view for all report viewers and we see from the stack trace that the exception is related to the paging in this view. You can set the ViewMode property of the report viewer to Print Preview (the standard view in previous versions) to see if the error goes away. Still even if it does, we would be grateful if you open a support ticket and attach a sample that causes this exception.

Regards,
Steve
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

Tags
General Discussions
Asked by
Peter
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or