Gantt chart crashes when StartDate and EndDate fields are properties of a nested class

See stack trace below. I have the following Gantt chart:


                    <SfGantt TValue="ProjectTask" DataSource="@_filteredTasks" Height="600px" ProjectStartDate="_selectedProject?.StartDate" ProjectEndDate="_selectedProject?.EndDate">

                        <GanttTaskFields Id="Task.Id" ParentID="Task.Parent" Name="Task.Title" StartDate="Task.StartDate" EndDate="Task.EndDate"></GanttTaskFields>

                        <GanttColumns>

                            <GanttColumn Field="Task.Id" HeaderText="ID"></GanttColumn>

                            <GanttColumn Field="Task.Title" HeaderText="Title" Width="250"></GanttColumn>

                            <GanttColumn Field="Task.StartDate" HeaderText="Start Date"></GanttColumn>

                            <GanttColumn Field="Task.EndDate" HeaderText="End Date"></GanttColumn>

                        </GanttColumns>

                    </SfGantt>


The TValue is a complex class like this:


public class ProjectTask

{

    public Task Task { get; set; }

}


The control works fine when StartDate and EndDate fields are properties of the ProjectTask class but not when they belong to the nested class.


Stack trace:


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

   at Syncfusion.Blazor.Gantt.Internal.Taskbar`1.UpdateTaskbarCursor()

   at Syncfusion.Blazor.Gantt.Internal.Taskbar`1.OnParametersSetAsync()

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

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

Microsoft.AspNetCore.Components.Web.ErrorBoundary: Warning: 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.Gantt.Internal.Taskbar`1.UpdateTaskbarCursor()

   at Syncfusion.Blazor.Gantt.Internal.Taskbar`1.OnParametersSetAsync()

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

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

Microsoft.AspNetCore.Components.Web.ErrorBoundary: Warning: 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.Gantt.Internal.Taskbar`1.UpdateTaskbarCursor()

   at Syncfusion.Blazor.Gantt.Internal.Taskbar`1.OnParametersSetAsync()

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

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

Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit '0Tg7aaw6bRUvMAo8vfTrNFtXVSOq9IPWrBMZqjhZ7Eo'.


System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

   at System.Collections.Generic.List`1.ForEach(Action`1 action)

   at Syncfusion.Blazor.Gantt.Internal.EventAggregators.Notify(String name, Object args)

   at Syncfusion.Blazor.Gantt.Internal.ChartBase`1.TimelineCellsAdd()

   at Syncfusion.Blazor.Gantt.SfGantt`1.ResetTimeline(Dictionary`2 args)

   at Syncfusion.Blazor.Gantt.SfGantt`1.InitializeScriptSide()

   at Syncfusion.Blazor.Gantt.Internal.TreeGridPane`1.InternalTreeGridBound(Object args)

   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)

   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.PostAsync[TState](Task antecedent, Action`1 callback, TState state)


1 Reply 1 reply marked as answer

AG Ajithkumar Gopalakrishnan Syncfusion Team April 10, 2024 01:05 PM UTC

Hi Marcel,

Greetings from Syncfusion Support.

We have reviewed your query, but we regret to say that currently we don’t have support to achieve your requirement. We have logged a feature request for the same and you can track the status of the feature from the feedback link given below.

Feedback Link : https://www.syncfusion.com/feedback/52685/need-to-provide-support-for-complex-data-binding-in-gantt-chart

We have already lined up some major features, we could not implement this support immediately. We will implement this and include it in any of our upcoming releases. Please cast your vote on this feature. Based on the customer demand we will prioritize the features in our upcoming road map. We are closing this ticket. You can communicate with us or track the status of the feature using the feedback link.

Regards,

Ajithkumar G


Marked as answer
Loader.
Up arrow icon