We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error to add Resource Assignment to task with duration "zero"

project.getResourceAssignments().add(task, resource);

Parameter name: value
class com.aspose.tasks.private.Exceptions.ArgumentException: Value cannot be NaN.
Parameter name: value
com.aspose.tasks.private.y.bg.a(Unknown Source)
com.aspose.tasks.private.y.bg.c(Unknown Source)
com.aspose.tasks.cyx.b(Unknown Source)
com.aspose.tasks.bdh.b(Unknown Source)
com.aspose.tasks.cyx.f(Unknown Source)
com.aspose.tasks.cyx.d(Unknown Source)
com.aspose.tasks.ResourceAssignmentCollection.add(Unknown Source)


Thank you for writing to Aspose support team.

I have tried to re-produce the scenario using following sample code but could not observe any issue. The project is created and saved successfully. Please give a try to the following sample code and let us know the feedback. If problem is not resolved, please send us a sample application along with any template file (if required). We will analyze the problem and provide assistance accordingly.

Project project = <span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;

Task rootTask = project.getRootTask();

Resource resource = project.getResources().add(
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;

Task a = rootTask.getChildren().add(
<span style=“font-size:9.0pt;
font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;color:green”>“A”

<span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:#660E7A”>DURATION
, project.getDuration(<span style=“font-size:9.0pt;
font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;color:blue”>0));

project.getResourceAssignments().add(a, resource);

File temp =
<span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:navy”>new
File(<span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:green”>“test_work_aspose.xml”

project.save(temp.getAbsolutePath(), SaveFileFormat.
<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;


It happens when add a.set(Tsk.TYPE, TaskType.FixedDuration);

Project project = new Project();
Task rootTask = project.getRootTask();
Resource resource = project.getResources().add(“Resource”);
Task a = rootTask.getChildren().add(“A”);
a.set(Tsk.DURATION, project.getDuration(0));
a.set(Tsk.TYPE, TaskType.FixedDuration);
project.getResourceAssignments().add(a, resource);


Thank you for providing the feedback. I have re-produced the issue here and logged it under Id:TASKS-34281 in our issue tracking system for further investigation by the product team. I shall write here as soon as some feedback is received in this regard.

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

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.