Getting exception when adding task assignment baseline and calculating the project

Hello Aspose Team,

I am getting the exception when adding the task assignment baseline and calculating the project.

if (task.Baselines != null && task.Baselines.Count > 0)
{
    totalBaselineWork = task.Baselines[0].Work.TimeSpan;
    totalUnits = task.Assignments.Sum(a => a.Units);
    if (totalUnits != 0 && totalBaselineWork.TotalHours > 0)
    {
        foreach (var a in task.Assignments)
        {
            if ((a.Baselines == null || a.Baselines.Count == 0 || a.Baselines[0].Work.TimeSpan == TimeSpan.Zero))
            {
                double proportion = a.Units / totalUnits;
                var newBaselineHrs = TimeSpan.FromHours(totalBaselineWork.TotalHours * proportion);
                var duration = task.ParentProject.GetDuration(newBaselineHrs.TotalHours);
                a.Baselines.Add(new AssignmentBaseline()
                {
                    Start = task.Baselines[0].Start,
                    Finish = task.Baselines[0].Finish,
                    Work = duration,
                });

                a.Work = task.ParentProject.GetDuration(newBaselineHrs.TotalHours);
                a.TimephasedData.Clear();

                recalculateRequired = true;
            }
        }
    }
}

I have attached sample mpp file. I am reading all tasks and adding task baseline assignment if assignment is not available. When I recalculate the project, getting the below exception.

date cannot be DateTime.MinValue (Parameter ‘date’)
at Aspose.Tasks.Calendar.#=ziqT6fxWcPFD$(DateTime #=zBBoIJ$8=)

Aspose8.zip (2.0 MB)

Thanks,
Imrankhan Pathan

@ikhan.pathan
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): TASKSNET-11714

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as TASKSNET-11714) have been fixed in this update.

Download page: https://releases.aspose.com/tasks/net/