TotalSlack not returning the proper values

When we import an MPP the Total Slack doesn’t come in properly from what we see in Projects. Most of the time it involves negative values coming in as zero, but sometime coming in as other negative values.

For example:
Id, Description, Project Value, task.Get(Tsk.TotalSlack)

19, EPC design, -94.5 days, 0
25, Interfaces, -342.63 days, 0
27, Topside, -376.25 days, -1806000
34, Outsourced PMO, -15.75 days, 0

Simple .mpp attached, along with a couple images

CurrentSchedule.zip (60.5 KB)
Comparison.png (4.5 KB)
ValueInProjects.png (11.9 KB)

@JamesPike

Can you please share that what should be the desired output as I will add the relative information for investigation as well in our issue tracking system.

Can you be more specific? The ValueInProjects.png shows what the values are in Project, and the Comparison.png shows the values in Project compared to what .Get(Tsk.TotalSlack) returns.

I’m not sure what you mean by expected values. I expect .Get(Tsk.TotalSlack) to return the same value as is shown in Project (in tenths of minutes of course).

@JamesPike

Can you please provide the used sample code so that I may log the issue in our issue tracking system.

Attached is a simple program that allows you to select a project file and populates a grid with the relevant values.TotalSlackIssue.zip (2.9 MB)

@JamesPike

I have created an issue with ID TASKSNET-10284 in our issue tracking system to further 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-10284) have been fixed in this update.

@JamesPike

The values of TotalSlack (and StartSlack, FinishSlack, FreeSlack) properties are expressed in tenths of a minutes.

Thus, to convert it to TimeSpan the following code can be used:

TimeSpan totalSlackDuration = TimeSpan.FromMinutes(task.Get(Tsk.TotalSlack) / 10);

So -1806000 value for task 27 converts to -3010 hours or -376,25 working days. For tasks 19, 25, 34 there is calculation issue that has been fixed in 21.8.

We plan to improve this API and change the return type of these properties to TimeSpan in next major release (22.1).

Thank you. I have confirmed it fixed the issue. However we ran into a change that I didn’t see documented anywhere concerning the NullableBool type.

Specifically we have a simple “if (task.Get(Tsk.IsActive))” statement that evaluates to true in 21.4 and to false in 21.8.

In both cases the return has the same properties:
task.Get(Tsk.IsActive)
{null}
#=zhGcRuoA=: false
#=zzqxLNmc=: true
IsDefined: false
Value: true

But it appears like in 21.8 maybe you all added to check IsDefined AND Value and in the 21.4 it just checked Value?

Is there any documentation of this change?

@JamesPike

I will share feedback with you concerning to this after having discussion with my team and request for your patience in this regard.

@JamesPike

You are right that the described behavior had changed in 21.5. Now both Value and IsDefined should be true in order to evaluate NullableBool to true.

We have updated documentation for implicit conversion operator:

and the example is shown in:

and

NullableBool | Aspose.Tasks for .NET API Reference.

Since, Aspose.Tasks for .NET 21.9 the changes are available.