Completed
Last Updated: 11 Jan 2021 13:00 by ADMIN
Release 2.21.0
Andrew
Created on: 04 Dec 2020 04:11
Category: UI for Blazor
Type: Bug Report
1
NRError when the tree is rendered. The last element has a list of children with the value NULL, after calling the "GetFlatItems" method, an error occurs.

1. Create tree model from class:


public class TreeNodeViewModel
{
    public string NodeName { get; set; }
    public IEnumerable<TreeNodeViewModel> Children { get; set; }
    public bool Expanded { get; set; }
    public string Color { get; set; }
    public string IconClass { get; set; }
}

2. Pass this tree for rendering to the component "TelerikTreeView".

3. An error comes out:

2020-12-03T09:44:15.312Z] Error: System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Blazor.Data.TelerikTreeViewDataSource.GetFlatItems(IEnumerable`1 tree, List`1 result)
   at Telerik.Blazor.Data.TelerikTreeViewDataSource.GetFlatItems(IEnumerable`1 tree, List`1 result)
   at Telerik.Blazor.Data.TelerikTreeViewDataSource.GetFlatItems(IEnumerable`1 tree, List`1 result)
   at Telerik.Blazor.Data.TelerikTreeViewDataSource.GetFlatItems(IEnumerable`1 tree, List`1 result)
   at Telerik.Blazor.Data.TelerikTreeViewDataSource.FlattenTree()
   at Telerik.Blazor.Data.TelerikTreeViewDataSource.InitData(IEnumerable`1 sourceData)
   at Telerik.Blazor.Data.TelerikTreeViewDataSource.ProcessData(IEnumerable data)
   at Telerik.Blazor.Components.TelerikTreeView.ProcessDataInternal()
   at Telerik.Blazor.Components.Common.DataBoundComponent`1.ProcessDataAsync()
   at Telerik.Blazor.Components.TelerikTreeView.OnAfterRenderAsync(Boolean firstRender)
   --- End of inner exception stack trace ---

 

Note: This problem is due to the fact that there are no children in the last node of the tree and IEnumerable Children == NULL. Method "GetFlatItems" in version 2.18.0 it had a NULL check, in version 2.20.0 it is not.

 
2 comments
ADMIN
Svetoslav Dimitrov
Posted on: 10 Dec 2020 18:56

Hello Andrew,

Thank you for bringing this issue to us.

I confirm that this is an issue introduced in our latest version. It will be fixed with the next version that's expected to be released in late January. Since you opened this Bug Report you are automatically subscribed for email notifications on status updates. 

I have updated your Telerik points for your report.

Regards,
Svetoslav Dimitrov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Andrew
Posted on: 04 Dec 2020 04:13
Fixed in a workaround: public IEnumerable<TreeNodeViewModel> Children { get; set; } = new TreeNodeViewModel[0];