I have found an error when I add a new resource to a parent task. The resource assignment should has 0 units and 0 days of work.
This error did not occur when I’ve had the same resource with 0 units and 0 days of work to a non-parent task.
We upgraded the assembly version of Aspose.Tasks from 17.3 to 17.7. This error didn’t occur in Aspose Tasks 17.3, but occurs on 17.7.
The upgrade from 17.3 to 17.7 is very important to us, since the new version solves at least 5 problems reported by our customers.
Error_Add_Resource_To_Parent_Tasks.mpp.mpp.zip (29.5 KB)
public void Error_Add_Resource_To_Parent_Tasks()
{
using (var stream = LoadFromAssembly("Error_Add_Resource_To_Parent_Tasks.mpp"))
{
var project = new Project(stream);
project.CalculationMode = CalculationMode.None;
/*
* First try: add resource R1 to task #1
*/
var task1 = project.RootTask.Children.GetById(1);
var resource1 = project.Resources.Add("R1");
resource1.Set(Rsc.Code, 1110000000000.ToString());
var atualAssignment = project.ResourceAssignments.Add(task1, resource1, 0);
atualAssignment.Set(Asn.Units, 0);
atualAssignment.Set(Asn.Work, new Duration());
// Ok, it works!
project.Recalculate();
/*
* Second try: add resource R2 to parent task #2
*/
var task2 = project.RootTask.Children.GetById(2);
var resource2 = project.Resources.Add("R2");
resource2.Set(Rsc.Code, 1110000000000.ToString());
var atualAssignment2 = project.ResourceAssignments.Add(task2, resource2, 0);
atualAssignment2.Set(Asn.Units, 0);
atualAssignment2.Set(Asn.Work, new Duration());
// Not ok. Throws a error!
project.Recalculate();
}
}