Completed
Last Updated: 27 Mar 2019 14:47 by Dimitar
Neal
Created on: 05 Mar 2019 13:48
Category: TreeView
Type: Bug Report
1
RadTreeView: right clicking on empty, white space, crashes our app

Hi there, through out our app we use the treeview everywhere - but we have had this issue where it crashes when someone right clicks on the treeview where there is no node. This crash happens on the "ContextMenuOpening" event when we try to use e.TreeElement. This is because, on the telerik side of things, the getter for that property is throwing a NullReferenceException (see attached screenshot)

 

I think this is happening because in your RadTreeViewCancelEventArgs.cs it is this:

        public RadTreeViewElement TreeElement
        {
            get { return node.TreeViewElement; }
        }

        public RadTreeView TreeView
        {
            get { return node.TreeView; }
        }

But since node == null, it throws the exception. It probably should check for null, and if node is null, return a null for those properties - so we can use null conditional operator to check stuff. We have a workaround but it is just lots of copy and paste of things.

Attached Files:
2 comments
Dimitar
Posted on: 27 Mar 2019 14:47
Hello, 
 
A Fix will be available in LIB Version 2019.1.401 scheduled for April 1st.

Best regards, 
Dimitar
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 06 Mar 2019 06:27
Hello, Neal,    
 
Indeed, the TreeElement is null in the TreeViewContextMenuOpeningEventArgs when you right-click on the empty space without any node being clicked. I have logged it in our feedback portal by making this thread public. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to use the sender in the ContextMenuOpening event which will give you the tree view element or check the Node in the event arguments before accessing the TreeElement

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.