NullReferenceException in RadTreeView when checking or unchecking node

11 posts, 0 answers
  1. Alex
    Alex avatar
    30 posts
    Member since:
    Aug 2010

    Posted 09 Feb 2012 Link to this post

    I get following exception when I check or unckec any node in RadTreeView.

    System.NullReferenceException: Object reference not set to an instance of an object.
       at Telerik.WinControls.UI.TreeNodeElement.ToggleElement_ToggleStateChanging(Object sender, StateChangingEventArgs args)
       at Telerik.WinControls.UI.RadToggleButtonElement.OnToggleStateChanging(StateChangingEventArgs e)
       at Telerik.WinControls.UI.TreeNodeCheckBoxElement.OnToggleStateChanging(StateChangingEventArgs e)
       at Telerik.WinControls.UI.RadToggleButtonElement.set_ToggleState(ToggleState value)
       at Telerik.WinControls.UI.TreeNodeCheckBoxElement.OnToggle()
       at Telerik.WinControls.UI.RadToggleButtonElement.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 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 Telerik.WinControls.UI.RadTreeView.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Version is 2011.3 11.1219 
    I can send you small sample with this exception. 
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 09 Feb 2012 Link to this post

    Hello,

    I haven't been able to replicate your issue. Please could you post a small exmaple here (using the code formatting block) in full (no outside datasources) that will replicate the issue.
    Thanks
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ilya
    Ilya avatar
    1 posts
    Member since:
    Sep 2012

    Posted 10 Feb 2012 Link to this post

    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;
    using Telerik.WinControls.UI;
     
    namespace TestApp
    {
        public partial class Form2 : Form
        {
            private readonly RadTreeView treeView;
             
            public Form2()
            {
                InitializeComponent();
     
                treeView = new RadTreeView
                           {
                               Dock = DockStyle.Fill,
                               CheckBoxes = true
                           };
                Controls.Add(treeView);
     
                Item root = new Item("Root");
                root.Childs.AddRange(new[]
                                     {
                                         new Item("Child 1"),
                                         new Item("Child 2"),
                                         new Item("Child 3"){Checked = true},
                                         new Item("Child 4"),
                                     });
                Initialize(root);
            }
     
            private void Initialize(Item root)
            {
                try
                {
                    treeView.BeginUpdate();
                    treeView.Nodes.Clear();
                    FillTree(root, treeView.Nodes);
                }
                finally
                {
                    treeView.EndUpdate();
                }
            }
     
            private void FillTree(Item item, RadTreeNodeCollection nodes)
            {
                RadTreeNode node = new RadTreeNode(item.Name)
                                   {
                                       Checked = (item).Checked
                                   };
                foreach (var child in item.Childs)
                {
                    FillTree(child, node.Nodes);
                }
     
                nodes.Add(node);
            }
        }
     
        class Item
        {
            private readonly string _name;
            private readonly List<Item> _childs = new List<Item>();
            private bool _checked = false;
     
            public Item(string name)
            {
                _name = name;
            }
     
            public string Name
            {
                get { return _name; }
            }
     
            public bool Checked
            {
                get { return _checked; }
                set { _checked = value; }
            }
     
            public List<Item> Childs
            {
                get { return _childs; }
            }
        }
    }
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 14 Feb 2012 Link to this post

    Hi Ilya,

    Thank you for sending us your code.

    We are still not able to reproduce the issue when using our latest release - Q3 2011 SP1. Could you please describe the exact steps to reproduce the issue? Thank you for your cooperation.

    I am looking forward to your reply.
     
    Kind regards,
    Jack
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Alex
    Alex avatar
    30 posts
    Member since:
    Aug 2010

    Posted 14 Feb 2012 Link to this post

    Please see the attached files. Here is the full text of error, you can see all assemblies here. Also I can email you project with referenced assemblies, if it helps.

    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.


    ************** Exception Text **************
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Telerik.WinControls.UI.TreeNodeElement.ToggleElement_ToggleStateChanging(Object sender, StateChangingEventArgs args)
       at Telerik.WinControls.UI.RadToggleButtonElement.OnToggleStateChanging(StateChangingEventArgs e)
       at Telerik.WinControls.UI.TreeNodeCheckBoxElement.OnToggleStateChanging(StateChangingEventArgs e)
       at Telerik.WinControls.UI.RadToggleButtonElement.set_ToggleState(ToggleState value)
       at Telerik.WinControls.UI.TreeNodeCheckBoxElement.OnToggle()
       at Telerik.WinControls.UI.RadToggleButtonElement.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 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 Telerik.WinControls.UI.RadTreeView.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)




    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.239 (RTMGDR.030319-2300)
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
    ----------------------------------------
    TestApp
        Assembly Version: 1.0.0.0
        Win32 Version: 1.0.0.0
        CodeBase: file:///D:/Progging/testRadTreeChecking/TestApp/bin/Debug/TestApp.exe
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.235 built by: RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.1 built by: RTMRel
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    System
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.236 built by: RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    Telerik.WinControls.UI
        Assembly Version: 2011.3.11.1219
        Win32 Version: 2011.3.11.1219
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Telerik.WinControls.UI/2011.3.11.1219__5bb2a467cbec794e/Telerik.WinControls.UI.dll
    ----------------------------------------
    Telerik.WinControls
        Assembly Version: 2011.3.11.1219
        Win32 Version: 2011.3.11.1219
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Telerik.WinControls/2011.3.11.1219__5bb2a467cbec794e/Telerik.WinControls.dll
    ----------------------------------------
    System.Configuration
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    ----------------------------------------
    System.Xml
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.233 built by: RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    TelerikCommon
        Assembly Version: 2011.3.11.1219
        Win32 Version: 2011.3.11.1219
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/TelerikCommon/2011.3.11.1219__5bb2a467cbec794e/TelerikCommon.dll
    ----------------------------------------
    qvpnb25m
        Assembly Version: 2011.3.11.1219
        Win32 Version: 4.0.30319.236 built by: RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
  7. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 17 Feb 2012 Link to this post

    Hi Alex,

    Thank you for writing us back.

    I managed to reproduce this issue. In my previous tests I used the wrong version - Q3 2011 2.11.831. This issue appears in version Q3 2011 SP1 3.11.1219. However, I am glad to inform you that the issue is addressed in Q1 2012 which we have just released and which is available at your account.

    If you have other questions, do not hesitate to contact me.
     
    Regards,
    Jack
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  8. Don
    Don avatar
    60 posts
    Member since:
    Aug 2010

    Posted 14 Mar 2012 Link to this post

    And here I was thinking I was the only person this had happened to. Now we'll be able to try the Q1 2012 release!
  9. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 16 Mar 2012 Link to this post

    Hi Don,

    Thank you for contacting us. Please write us if the issue continues to appear when using our latest release.
     
    Greetings,
    Jack
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  10. Don
    Don avatar
    60 posts
    Member since:
    Aug 2010

    Posted 24 Apr 2012 Link to this post

    Tried 2012 Q1 SP1 yesterday. The treeview now loads initially, but still eats a parameter when a child node is clicked. This is using the exact same code base that has a working treeview in 2011 Q2 SP2. We're rolling out this application in four weeks, so I do not have time to track down a root cause, find a workaround or create a sample project to reproduce the behavior.
  11. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 27 Apr 2012 Link to this post

    Hi Don,

    It looks like the issue you are facing is slightly different from the one discussed in this thread. Could you please send us your project so we can debug and locate the issue. Thank you for your cooperation.

    Please note that you have to open a new support ticket in order to be able to attach your project.

    I am looking forward to your reply.
     
    Greetings,
    Jack
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  12. Don
    Don avatar
    60 posts
    Member since:
    Aug 2010

    Posted 30 Apr 2012 Link to this post

    As soon as I get a chance, I will.
Back to Top
UI for WinForms is Visual Studio 2017 Ready