TasksWritingException: Writing resource assignments started while saving resource with zero units (C# .NET)

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"));

        //oMPPPRoj.Recalculate();

        //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);

}

@Rajeshrv,

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.

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

@Rajeshrv

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

2013ProjectTemplate.zip (28.1 KB)
@Adnan.Ahmad PFA of mpt file used in my code.

Thank you.

@Rajeshrv,

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.

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

Is the issue resolved?

Please share source code along with dll , if issue is resolved.

I am nable to save new mpp file so.

Since we decide to go with 19.3 for our current release, didn’t tried the fix.
May be will update know I once try the latest dll.

Thank you.

@Rajeshrv
Can i have your sample code along with dll which version you are using

@ramyaakula
I was trying to use 19.5 Aspose.Task.dll from Downloads ---New-Releases--aspose.tasks-for-.net-19.5-(dlls-only) ., and sample code you can find from this support TasksWritingException: Writing resource assignments started while saving resource with zero units (C# .NET)

@Rajeshrv,

Can you please confirm if your issue is resolved?

Team,
I just verified the behavior with 19.7 Aspose.Task.dll and the behavior looks fine.

Thank you.

@Rajeshrv,

This issue has been resolved. You are very welcome.