Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

Adding a sub class to the documentation sample of the Blazor DataGrid (Syncfusion.Blazor 19.1.0.59) throws a runtime exception.

The following sample code is based on https://blazor.syncfusion.com/documentation/datagrid/data-binding/#list-binding


Only a class "Product" was added together with a property in the "Order" class and a column in the datagrid.


@code{

    public List Orders { get; set; }


    protected override void OnInitialized()

    {

        var product = new Product() { Name = "Sample Product"};


        Orders = Enumerable.Range(1, 75).Select(x => new Order()

        {

            OrderID = 1000 + x,

            CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],

            Freight = 2.1 * x,

            OrderDate = DateTime.Now.AddDays(-x),

            Product = product

        }).ToList();

    }


    public class Order

    {

        public int? OrderID { get; set; }

        public string CustomerID { get; set; }

        public DateTime? OrderDate { get; set; }

        public double? Freight { get; set; }

        public Product Product { get; set; }

    }


    public class Product

    {

        public string Name { get; set; }

    }

}


And the datagrid column like this: 

GridColumn Field=@nameof(Order.Product.Name) HeaderText="Product Name" Width="50"



Exception thrown because of added column "Product Name":

blazor.webassembly.js:1

crit:

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]

Unhandled exception rendering component: Object reference not set to an instance of an object.

System.NullReferenceException: Object reference not set to an instance of an object.

at Syncfusion.Blazor.Grids.Internal.PropertyInfoHelper.CreateAccessor(PropertyInfo propertyInfo)

at Syncfusion.Blazor.Grids.Internal.PropertyInfoHelper.GetAccessor(String name, IDictionary`2 cache, Object from)

at Syncfusion.Blazor.Grids.Internal.PropertyInfoHelper.GetFieldValue(String nameSpace, Object from, IDictionary`2 cache)

at Syncfusion.Blazor.Grids.Internal.PropertyInfoHelper.GetObject(String nameSpace, Object from)

at Syncfusion.Blazor.Grids.Internal.GridCellBase`1[[BlazorGrid.Client.Pages.ListDataExample.Order, BlazorGrid.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetValue()

at Syncfusion.Blazor.Grids.Internal.GridCellBase`1.d__36[[BlazorGrid.Client.Pages.ListDataExample.Order, BlazorGrid.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()

at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)

at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()