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

Free Support Forum - aspose.com

TimeSpan does not accept floating point Not-a-Number values (C# .NET)

2013ProjectTemplate.zip (28.1 KB)
Am trying to create a project with task as shown below, while assigning the resource getting an error “TimeSpan does not accept floating point Not-a-Number value”

        string testTemplate = "2013ProjectTemplate.mpt";
        Project oMPPPRoj = new Project(sPath + testTemplate)
            CalculationMode = CalculationMode.Manual

        Resource res2 = oMPPPRoj.Resources.Add("Resource 2");

        DateTime projectstartdate = Convert.ToDateTime("03-Jul-2019");
        DateTime projectenddate = Convert.ToDateTime("10-Jul-2019");
        oMPPPRoj.Set(Prj.StartDate, projectstartdate);
        oMPPPRoj.Set(Prj.FinishDate, projectenddate);

        DateTime tskstartdate = Convert.ToDateTime("05-Jul-2019");
        DateTime tskenddate = Convert.ToDateTime("09-Jul-2019");

        Aspose.Tasks.Task tsk3 = oMPPPRoj.RootTask.Children.Add("Task 3");
        tsk3.Set(Tsk.Type, TaskType.FixedDuration);
        tsk3.Set(Tsk.IsManual, true);

        tsk3.Set(Tsk.Start, tskstartdate);
        tsk3.Set(Tsk.Finish, tskstartdate);
        tsk3.Set(Tsk.Deadline, tskenddate);

        Duration oTskDuration = oMPPPRoj.GetDuration(8, TimeUnitType.Hour);
        tsk3.Set(Tsk.Work, oTskDuration);
        ResourceAssignment resAsn5 = oMPPPRoj.ResourceAssignments.Add(tsk3, res2);

        resAsn5.Set(Asn.Units, 1);
        oMPPPRoj.Save("SavedMPP.mpp", Aspose.Tasks.Saving.SaveFileFormat.MPP);

Can you please confirm what is wrong here.


I have used your sample code using Aspose.Tasks for .NET 19.12 on my end and have not been able to observe any issue while executing the code sample. Can you please try using suggested version along with applying license before using above mentioned code.

SavedMPP.mpp.zip (29.5 KB)

Thanks for the quick update. We are currently using version 19.8, I just tried with 19.12 and seems to be working fine.


Thank you for sharing the feedback.