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

Treeview crash

5 Answers 182 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Frédéric
Top achievements
Rank 1
Frédéric asked on 12 Aug 2008, 03:17 PM

Hi,

When I move by mistakes a node on the node over him, the application crash with the error bellow.

To reproduce this,
> Create a treeView with 2 nodes inside!
> Move the second node into the first one,
> Do it again (Move the second node that is already into the first one exactly as you did before)

I hope you can reproduce it and tell me how to avoid this problem.

Best regards, Fred




System.ArgumentOutOfRangeException was unhandled
  Message="Index must be within the bounds of the List.\r\nParameter name: index"
  Source="mscorlib"
  ParamName="index"
  StackTrace:
       at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
       at System.Collections.Generic.List`1.Insert(Int32 index, T item)
       at Telerik.WinControls.UI.RadTreeNodeCollection.InsertItem(Int32 index, RadTreeNode node)
       at System.Collections.ObjectModel.Collection`1.Add(T item)
       at Telerik.WinControls.UI.RadTreeView.FinalizeDrop(RadTreeNode targetNode, RadTreeNode draggedNode, ArrowDirection arrowDirection, RadTreeView endTree)
       at Telerik.WinControls.UI.RadTreeView.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 WindowsApplication1.Program.Main() in C:\Documents and Settings\badoux0f\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Program.cs:line 17
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()



5 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 13 Aug 2008, 09:08 AM
Hi Frédéric,

Thank you for writing.
This is due to a undocumented behavior of the Add method of the tree node collection that was fixed for the Q2 2008 release. This issue is already fixed and will not be present in the upcoming Q2 2008 SP1 release.

Best wishes,
Jordan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Frédéric
Top achievements
Rank 1
answered on 13 Aug 2008, 01:34 PM

Thanks for this answer.

So actually, there is no work around if the users make a wrong manipulation?

Do you know when the Q2 2008 SP1 will be release???

0
Accepted
Jordan
Telerik team
answered on 14 Aug 2008, 08:40 AM
Hello Frédéric,

The SP1 release is scheduled for the end of this month.
In the meantime you could try canceling the add operation if the collection already contains the node like:
public Form1() 
        { 
            this.radTreeView1.Nodes.CollectionChanging += new Telerik.WinControls.Data.NotifyCollectionChangingEventHandler(Nodes_CollectionChanging); 
        } 
 
        void Nodes_CollectionChanging(object sender, Telerik.WinControls.Data.NotifyCollectionChangingEventArgs e) 
        { 
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add) 
            { 
                if ((sender as RadTreeNodeCollection).Contains(e.NewItems[0] as RadTreeNode)) 
                { 
                    e.Cancel = true
                } 
            } 
        } 

Don't hesitate to contact us if you have other questions.

Greetings,
Jordan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mehdi
Top achievements
Rank 1
answered on 20 Jun 2011, 12:34 PM

Hi,
First of all  thank  you for your  great  forum.

Unfortunately, I have the same problem in Q1 2011 when I drag a node to the top of the first row and drop it the application crash with the error bellow!

"Index must be within the bounds of the List. 
 Parameter name: index"

I hope you can help me handle it?!

Thanks and best regards,


0
Svett
Telerik team
answered on 22 Jun 2011, 01:34 PM
Hello Mehdi,

Please find the answer of your question in your thread "Drag & Drop Crash on Moving a Node to the Top Row!".

All the best,
Svett
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
Treeview
Asked by
Frédéric
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Frédéric
Top achievements
Rank 1
Mehdi
Top achievements
Rank 1
Svett
Telerik team
Share this question
or