TaskValidationException Class

Represents an exception which is thrown when errors are found in project's tasks after recalculation.
Inheritance Hierarchy
SystemObject
  SystemException
    SystemApplicationException
      Aspose.TasksValidationException
        Aspose.TasksRecalculationValidationException
          Aspose.TasksTaskValidationException

Namespace:  Aspose.Tasks
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 21.10
Syntax
[SerializableAttribute]
public class TaskValidationException : RecalculationValidationException

The TaskValidationException type exposes the following members.

Constructors
  NameDescription
Protected methodCode exampleTaskValidationException
Initializes a new instance of the TaskValidationException class.
Properties
  NameDescription
Public propertyData (Inherited from Exception.)
Public propertyHelpLink (Inherited from Exception.)
Protected propertyHResult (Inherited from Exception.)
Public propertyInnerException (Inherited from Exception.)
Public propertyMessage (Inherited from Exception.)
Public propertySource (Inherited from Exception.)
Public propertyStackTrace (Inherited from Exception.)
Public propertyTargetSite (Inherited from Exception.)
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetBaseException (Inherited from Exception.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetObjectData (Inherited from Exception.)
Public methodGetType (Inherited from Exception.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Exception.)
Examples
Shows on what conditions <see cref="TaskValidationException" /> exception can be thrown.
try
{
    var project = new Project { CalculationMode = CalculationMode.None };
    var task = project.RootTask.Children.Add("Task");

    // accidentally set incorrect dates
    task.Set(Tsk.Start, new DateTime(2017, 6, 19, 8, 0, 0));
    task.Set(Tsk.Duration, project.GetDuration(1));
    task.Set(Tsk.Finish, new DateTime(2017, 6, 18, 17, 0, 0));

    // run project recalculation with a flag to run validation   
    project.Recalculate(true);
}
catch (TaskValidationException ex)
{
    Console.WriteLine(ex.Message);
}
See Also