Hello,
I have 2 projects. For the first project, methods:
OutlineIndent() and OutlineOutdent()
work without issues (attached file: MyProject1xml.xml).
For second file these methods are not working (attached file: Tasks-Test_Project.xml).
I become the error:
The operation has failed with error: Date cannot be DateTime.MinValue Parameter name: date
Can You, please, write me, where there might be a problem?
BR and thanks
Otomar Naprstek
P.S.
Sorry, for ma bad English language.
Hi Otomar,
Thank you for writing to Aspose support team.
Could you please share the sample code that you are trying to execute at your end? Specifically, we’ll be in need of the task that you are trying to outdent or indent. We’ll look into it and assist you further accordingly.
Hi Kashif,
thanks for Your reply. I am using this code:
Aspose.Tasks.ProjectReader projectReader = new Aspose.Tasks.ProjectReader();
FileStream projectStream = new FileStream(projectFile, FileMode.Open);
Aspose.Tasks.Project project = projectReader.Read(projectStream);
projectStream.Close();
//where projectFile is my project xml file.
var taskT = project.GetTaskByUid(4); //Task Uid, which produces the error, but You can try some others
taskT.OutlineIndent(); // this command produces an ERROR
project.UpdateReferences();
project.Save(projectFile, Aspose.Tasks.Saving.SaveFileFormat.XML);
ERROR with Stack Trace:
Date cannot be DateTime.MinValue
Parameter name: date
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Date cannot be DateTime.MinValue
Parameter name: date
Stack Trace: [ArgumentOutOfRangeException: Date cannot be DateTime.MinValue
Parameter name: date]
Aspose.Tasks.Calendar.GetPreviousWorkingDayEnd(DateTime date) +256
Aspose.Tasks.Calendar.GetStartDateFromFinishAndDuration(DateTime finish, TimeSpan duration) +820
..(DateTime , TimeSpan , Calendar ) +288
..(Task ) +1196
..(Task ) +1131
..e(List`1 , ) +178
..() +132
..() +54
..() +110
Aspose.Tasks.Task.Recalculate(Task task) +239
Aspose.Tasks.Task.OutlineIndent() +360
OneView.Widgets.BuiltIn.GanttView.Widgets.BuiltIn.GanttView.wGanttView.ReadProjectDataAspose(String projectFile) in C:\Work\Projects\Bemasoft\OneView II Public\Development\trunk\Widgets\BuiltIn\OneView.Widgets.BuiltIn.GanttView\Widgets\BuiltIn\GanttView\wGanttView.ascx.cs:517
OneView.Widgets.BuiltIn.GanttView.Widgets.BuiltIn.GanttView.wGanttView.ddlRecentlyViewed_SelectedIndexChanged(Object sender, EventArgs e) in C:\Work\Projects\Bemasoft\OneView II Public\Development\trunk\Widgets\BuiltIn\OneView.Widgets.BuiltIn.GanttView\Widgets\BuiltIn\GanttView\wGanttView.ascx.cs:336
System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +116
System.Web.UI.WebControls.DropDownList.RaisePostDataChangedEvent() +133
System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +13
System.Web.UI.Page.RaiseChangedEvents() +132
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1644
|
I hope, this will be useful for You.
Thanks and BR
Otomar Naprstek
Hi Otomar,
Thank you for providing more information.
I have tried to open the file “Tasks-Test_Project.xml” in Microsoft Project 2010 but am afraid to share that it could not be opened in MSP. It raises exception while opening the file and finally shows zero tasks.
Could you please provide us the appropriate “Tasks-Test_Project.xml” which can be opened in MSP 2010 without any error? As this file cannot be opened in MSP so it does not seem to be an issue with the Aspose.Tasks library but some sort of inconsistency in the source XML file.
Please feel free to write us back if you have any other query in this regard.