Setting Task Duration w/ Resource not recalculating correctly for first Task

Using Aspose.Tasks 21.4.0.0

Original project created via Microsoft Project. It contains three automatically scheduled Tasks, each assigned to the same Resource. Opening the project in Aspose.Tasks, Set the CalculationMode to Manual. Loop through the Tasks and change each Task Duration from 3 to 8 Days. Perform a recalculation. Task 1 is reverting back to 3 days, Task 2 and Task 3 are correctly set to 8 Days and the overall schedule is adjusted.

If I remove the resource assignment from Task 1, the recalculation behaves as expected.

Any suggestions?

Project.png (32.1 KB)
Results_Bad.png (6.0 KB)
Results_Good.png (6.1 KB)

Code Sample:

            string fileName = @"D:\_Projects\RSA\Test Files\Project_3B.mpp";
            var project = new Project(fileName);
            project.CalculationMode = Aspose.Tasks.CalculationMode.Manual;

            var coll = new ChildTasksCollector();
            TaskUtils.Apply(project.RootTask, coll, 0);

            var task1 = coll.Tasks[1];
            var task2 = coll.Tasks[2];
            var task3 = coll.Tasks[3];

            Console.WriteLine("");
            Console.WriteLine("Before Change");
            Console.WriteLine("Task1 Start : {0} ", task1.Get(Tsk.Start));
            Console.WriteLine("Task1 Finish : {0} ", task1.Get(Tsk.Finish));
            Console.WriteLine("Task1 Duration : {0} ", task1.Get(Tsk.Duration));
            Console.WriteLine("Task2 Start : {0} ", task2.Get(Tsk.Start));
            Console.WriteLine("Task2 Finish : {0} ", task2.Get(Tsk.Finish));
            Console.WriteLine("Task2 Duration : {0} ", task2.Get(Tsk.Duration));
            Console.WriteLine("Task3 Start : {0} ", task3.Get(Tsk.Start));
            Console.WriteLine("Task3 Finish : {0} ", task3.Get(Tsk.Finish));
            Console.WriteLine("Task3 Duration : {0} ", task3.Get(Tsk.Duration));

            task1.Set(Tsk.Duration, project.GetDuration(8, TimeUnitType.Day));
            task2.Set(Tsk.Duration, project.GetDuration(8, TimeUnitType.Day));
            task3.Set(Tsk.Duration, project.GetDuration(8, TimeUnitType.Day));

            Console.WriteLine("");
            Console.WriteLine("After Change");
            Console.WriteLine("Task1 Start : {0} ", task1.Get(Tsk.Start));
            Console.WriteLine("Task1 Finish : {0} ", task1.Get(Tsk.Finish));
            Console.WriteLine("Task1 Duration : {0} ", task1.Get(Tsk.Duration));
            Console.WriteLine("Task2 Start : {0} ", task2.Get(Tsk.Start));
            Console.WriteLine("Task2 Finish : {0} ", task2.Get(Tsk.Finish));
            Console.WriteLine("Task2 Duration : {0} ", task2.Get(Tsk.Duration));
            Console.WriteLine("Task3 Start : {0} ", task3.Get(Tsk.Start));
            Console.WriteLine("Task3 Finish : {0} ", task3.Get(Tsk.Finish));
            Console.WriteLine("Task3 Duration : {0} ", task3.Get(Tsk.Duration));

            project.Recalculate();

            Console.WriteLine("");
            Console.WriteLine("After Recalculate");
            Console.WriteLine("Task1 Start : {0} ", task1.Get(Tsk.Start));
            Console.WriteLine("Task1 Finish : {0} ", task1.Get(Tsk.Finish));
            Console.WriteLine("Task1 Duration : {0} ", task1.Get(Tsk.Duration));
            Console.WriteLine("Task2 Start : {0} ", task2.Get(Tsk.Start));
            Console.WriteLine("Task2 Finish : {0} ", task2.Get(Tsk.Finish));
            Console.WriteLine("Task2 Duration : {0} ", task2.Get(Tsk.Duration));
            Console.WriteLine("Task3 Start : {0} ", task3.Get(Tsk.Start));
            Console.WriteLine("Task3 Finish : {0} ", task3.Get(Tsk.Finish));
            Console.WriteLine("Task3 Duration : {0} ", task3.Get(Tsk.Duration));

@mosborne818

I have observed the images provided by you. Can you please provide the source MPP file that we may used on our end to further investigate the issue.

I’ve uploaded both the test MPP file and the C# class that was used for testing.

Thank you!

Project_3C.7z (14.8 KB)
Class1.7z (1.9 KB)

@mosborne818

Thank you for sharing the information and I have been able to observe the issue. A ticket with ID TASKSNET-4866 has been created to further investigate and resolve the issue. This thread has bene linked with the issue so that you may be notified once the issue will be addressed.

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