Hello,
I have an XER file Duration_convert_bug.zip (468,0 Ko) where the duration is set in hours. When I attempt to convert the duration from hours to days using the Duration Convert
function, I end up with an infinity value. For example, 920 hours gets converted as shown here:
image.png (634 Octets)
Here’s the code I’m using:
DurationOriginal = task.Get(Tsk.Duration).Convert(Day);
Where task
is an Aspose.Tasks.Task
object.
Could you help me understand what might be going wrong?
Thanks!
@Nour_From_XLSTAT
Investigation shown that Project’s HoursPerMonth MinutesPerWeek and MinutesPerDay are initialized when reading the attached file.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): TASKSNET-11279
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@Nour_From_XLSTAT ,
as a workaround you can init these values manually:
var project = new Project(@"CRO-hourdayBug.xer");
if (project.MinutesPerDay == 0)
{
project.MinutesPerDay = 8 * 60;
project.MinutesPerWeek = 5 * 8 * 60;
}
var t = project.RootTask.Children.GetByUid(2);
var d = t.Duration.Convert(TimeUnitType.Day);
Console.WriteLine("{0} - {1}", t.Uid, d.ToString());
Thanks for the workaround, it works!
The issues you have found earlier (filed as TASKSNET-11279) have been fixed in this update.
Download link