Free Support Forum - aspose.com

Setting complete percent to milestone task

I’ve found some issues when I set the ActualStart, ActualFinish and ActualDuration of a zero days milestone task. The setting is ignored after I set ActualFinish (see example above).

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.5, 17.6 and 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.

public void Setting_Complete_Percent_To_Milestone_Task()
{
	using (var stream = ProjetoPadrao.Carregar())
	{
		var project = OpenProject(stream);

		DateTime start = new DateTime(2017, 08, 18, 9, 0, 0);
		DateTime finish = new DateTime(2017, 08, 18, 9, 0, 0);
		Duration duration = project.GetDuration(0);

		DateTime actualStart = new DateTime(2017, 08, 21, 9, 0, 0);
		DateTime actualFinish = new DateTime(2017, 08, 21, 18, 0, 0);
		Duration actualDuration = project.GetDuration(8, TimeUnitType.Hour);

		project.CalculationMode = CalculationMode.Automatic;

		var task1 = project.RootTask.Children.Add("T1");

		task1.Set(Tsk.Start, start);
		task1.Set(Tsk.Duration, duration);
		task1.Set(Tsk.Finish, finish);
				
		var resource1 = project.Resources.Add("R1");
		project.ResourceAssignments.Add(task1, resource1);

		// These assertions do alright!
		Assert.AreEqual(start, task1.Get(Tsk.Start), "Error! Task T1 should be started at 2017-08-21 09:00:00");
		Assert.AreEqual(finish, task1.Get(Tsk.Finish), "Error! Task T1 should be finished at 2017-08-21 18:00:00");
		Assert.AreEqual(duration, task1.Get(Tsk.Duration), "Error! Task T1 should have 1 day of duration");
		Assert.IsTrue(task1.Get(Tsk.IsMilestone), "Error! Task T1 should be a milestone");

		// Set actual dates and durations of task
		task1.Set(Tsk.ActualStart, actualStart);
		task1.Set(Tsk.ActualDuration, actualDuration);
		task1.Set(Tsk.ActualFinish, actualFinish);

		// These assertions didn't work...
		Assert.AreEqual(actualStart, task1.Get(Tsk.ActualStart), "Error! Task T1 should be started at 2017-08-21 09:00:00");
		Assert.AreEqual(actualFinish, task1.Get(Tsk.ActualFinish), "Error! Task T1 should be finished at 2017-08-21 18:00:00");
		Assert.AreEqual(actualDuration, task1.Get(Tsk.ActualDuration), "Error! Task T1 should have 1 day of duration");
	}
}

@siteware,

Thank you for writing to Aspose support team.

I have analyzed this issue and observed the problem. It is logged under Id:TASKSNET-2054 for further investigation by the product team. You will be automatically notified once any update is received in this regard.

@siteware,

This issue has been fixed in the latest release of Aspose.Tasks for .NET 17.8. Please feel free to write to us in case of any further query in this regard.