Aspose Tasks 19.5 throws error while saving resource with zero units


Hello Team,
I tried to upgrade my application with Aspose Tasks 19.5 and getting below exception,

“Aspose.Tasks.TasksWritingException: 'Writing resource assignments started.
Writing assignment with UID=‘1’ started.
Writing assignment with UID=‘1’ finished.
Writing assignment with UID=‘2’ started.”

Sample code to reproduce the same

public static void CreateNewProjectFile1(string sPath)
string testTemplate = “2013ProjectTemplate.mpt”;//Use some project file
Project oMPPPRoj = new Project(sPath + testTemplate)
CalculationMode = CalculationMode.Manual
DateTime projectstartdate = Convert.ToDateTime(“03-Jul-2017”);
DateTime projectenddate = Convert.ToDateTime(“10-Jul-2017”);
oMPPPRoj.Set(Prj.StartDate, projectstartdate);
oMPPPRoj.Set(Prj.FinishDate, projectenddate);

		Aspose.Tasks.Task tsk = oMPPPRoj.RootTask.Children.Add("Task 1");
		DateTime tskstartdate = Convert.ToDateTime("05-Jul-2017");
		DateTime tskenddate = Convert.ToDateTime("07-Jul-2017");
		tsk.Set(Tsk.Start, tskstartdate);
		tsk.Set(Tsk.Finish, tskenddate);

        oMPPPRoj.ResourceAssignments.Add(tsk, oMPPPRoj.Resources.Add("TestRes1"));
        ResourceAssignment anResAssign = oMPPPRoj.ResourceAssignments.Add(tsk, oMPPPRoj.Resources.Add("AnResTest2"));


        //tsk.Set(Tsk.ConstraintType, ConstraintType.AsSoonAsPossible);
        //tsk.Set(Tsk.ConstraintDate, projectenddate);
        anResAssign.Set(Asn.Units, 0);

        oMPPPRoj.Save("SavedMPP.mpp", Aspose.Tasks.Saving.SaveFileFormat.MPP);




I have observed the issue shared by you and request you to please provide the source file used in sample code that we may use on our end to further verify the issue.


Can you confirm what source file you wanted, as I have already shared the complete code for reproducing the issue.



Please share files which you are loading in your sample code.

#5 (28.1 KB)
@Adnan.Ahmad PFA of mpt file used in my code.

Thank you.



Thank you for providing the source file. I have worked with sample code and source file shared and have been able to observe the issue on my end. An issue with ID TASKSNET-3297 has been created in our issue tracking system to investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.