We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Hiding nodes in tree view causes exception

I have a list of nodes in the tree view that I would like to hide.

I use this code:

 NodeList.ForEach(k => {

 try

           {

              k.Visible = false;

            }catch (Exception e){

              Debug.WriteLine(e.ToString());

            }

              });

 Sometimes I get:


Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv.set_Visible(Boolean value)

The node I am working on is a valid node. It has text properties and is certainly not null.

What can be going wrong?

5 Replies

SR Sabaridass Ramamoorthy Syncfusion Team April 26, 2019 11:28 AM UTC

Hi Lenny, 

Thanks for contacting Syncfusion Support. 

We have checked the reported issue – “Exception was thrown when hiding the tree nodes” in our working sample. Unfortunately we are unable to reproduce the reported issue in our side. Kindly refer to attached video and sample from below location. 

Could you please modify the attached sample to reproduce the reported issue? So that it would be helpful for us to proceed further. 

Regards, 
Sabaridass R 



LE Lenny April 26, 2019 08:01 PM UTC

Hi Sabaridass,
We have found that the TreeView property of the Node is set to null sometimes after visibility changes (or other behavior).
When we restore that reference, the problem goes away.

Please also check your Visibility setter. Gives a problem if TreeView is set to null


SR Sabaridass Ramamoorthy Syncfusion Team April 29, 2019 10:26 AM UTC

Hi Lenny,

Based on your previous update, we have prepared a patch for testing purpose by checking the null values proactively in Setter method of Visible property. Kindly test the below patch and let us know whether the reporting problem is resolved at your end. Based on your update we could proceed further on this query.

v17.1.0.38 
Recommended approach – exe will perform automatic configuration     
Please find the patch setup here:                           
Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment                      
Please find the Nugets from the below location:     
     
NOTE
You can change how you receive bug fixes by navigating to the following link and updating your preferences.
https://www.syncfusion.com/support/directtrac/patches  
   
Regards, 
Sabaridass R 



LE Lenny April 29, 2019 04:48 PM UTC

Hi Sabaridass,

We found many other issues related to the node visibility issue. We opened case #234751  in Direct Trac, because we need a faster resolution.

Hopefully they can be addressed.
Thanks
Lenny





SR Sabaridass Ramamoorthy Syncfusion Team April 30, 2019 06:49 AM UTC

Hi Lenny, 
 
Thanks for the update. We can address the reported issues in #234751 and you can follow up the same if you need any further assistance on this. 
 
Regards, 
Sabairdass R 


Loader.
Live Chat Icon For mobile
Up arrow icon