Error on PDF export when date values are null

Hallo,

I try to export my Blazor Gantt to PDF.

The datasource contains items where start and end date are null.

When I call ExportToPdfAsync, I get following error:

 System.InvalidOperationException: StartDate cannot be null.

         at Syncfusion.Blazor.Gantt.Internal.PdfTaskbar`1.UpdateTaskbarLeft(List`1 records)

         at Syncfusion.Blazor.Gantt.Internal.PdfBase`1.DrawGridCell(PdfPage pdfPage)

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

         at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<Post>b__12_0(ValueTuple`2 s)

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

What can I do?

Best regards

Clas-Goedeke



1 Reply

AG Ajithkumar Gopalakrishnan Syncfusion Team October 10, 2025 12:40 PM UTC

Hi Clas,

Greetings from Syncfusion Support,

We have reviewed the reported issue and were able to replicate it on our end. The issue occurs when the AllowUnscheduledTasks property is set to true, resulting in StartDate and EndDate being null. This causes a problem during PDF export in the Gantt Chart.

Currently, PDF export for unscheduled tasks is not supported. As a workaround, we recommend setting AllowUnscheduledTasks to false to avoid this issue. Please find below the code snippets for both the issue scenario and the suggested solution.

// issue case

<SfGantt @ref="Gantt" AllowPdfExport DataSource="@TaskCollection" Toolbar="toolbarItem" Height="450px" Width="700px" AllowUnscheduledTasks="true">

    <GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"

                     Duration="Duration" Progress="Progress" ParentID="ParentId">

    </GanttTaskFields>

    <GanttEvents OnToolbarClick="ToolbarClickHandler" TValue="TaskData"></GanttEvents>

</SfGantt>

// Solution

<SfGantt @ref="Gantt" AllowPdfExport DataSource="@TaskCollection" Toolbar="toolbarItem" Height="450px" Width="700px" AllowUnscheduledTasks="false">

    <GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"

                     Duration="Duration" Progress="Progress" ParentID="ParentId">

    </GanttTaskFields>

    <GanttEvents OnToolbarClick="ToolbarClickHandler" TValue="TaskData"></GanttEvents>

</SfGantt>

Sample link: https://blazorplayground.syncfusion.com/embed/rNBesNWXzUTrAvQi?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

For more information, you may refer to the following link:

https://blazor.syncfusion.com/documentation/gantt-chart/scheduling-tasks#automatically-scheduled-tasks

https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_AllowUnscheduledTasks

If you have any further questions or need additional assistance, please let me know!

Regards,
Ajithkumar G


Loader.
Up arrow icon