Free Support Forum - aspose.com

Getting Error with Aspose.Tasks

Hi I am getting the below error while using Aspose.tasks:

An element with the same key already exists in the dictionary.

@IshuAbrol,

Please share your sample file and code with us for further analysis at our end.

task = project.getRootTask().getChildren().add(appNum);
System.out.println("StartDate: " +getDateTime(sDate) + " EndDate: " +getDateTime(endDate));
task.set(Tsk.DURATION_FORMAT, TimeUnitType.Day);

              task.set(Tsk.CONTACT, equipment);
              // new fields
              task.set(Tsk.IS_MARKED, true);
              task.set(Tsk.IGNORE_WARNINGS, true);
              task.set(Tsk.START,getDateTime(sDate));
               double minutes= (double)getDurationInMinutes(getDateTime(sDate), getDateTime(endDate));
             
              task.set(Tsk.DURATION, project.getDuration(minutes));
              task.set(Tsk.FINISH,getDateTime(endDate));

The problem is for first row while creating mpp file- start and end date are coming with proper time and date as:
July 26 2018 08:00 to 4:00 pm
but the second row onwards its not giving the correct time - Aug 09 2018 08:00 and end date should be Aug 09 2018 16: 00
But by running the above code its giving as Aug 09 4:00 to Aug 09 04:00 (Start and end date is showing as same)
Please advise.

error.png (40.7 KB)
As highlighted still some of the rows are showing wrong time period while others are showing correct. Could you please advise. I am taking input from oracle database and trying to create mpp file by plugging in the values from the database.
P.S : Database values are coming correctly and I have displayed them too but somehow while displaying its not showing correct data. Could you please advise.

@IshuAbrol,

We are looking into this issue and will soon update you with our findings.

@IshuAbrol,

We have tried to reproduce this issue using some sample data but it is not re-produced. You may please provide us a complete console application which can be compiled and executed here without any missing reference. The data which is extracted from database, should be hard-coded or some array etc. shall be used so that example can be executed without any connection to the database. Similarly the template MPP file which is used for creating the output MPP file shall also be shared with us. We want this complete issue to be reproduced here for our analysis so that we may provide assistance accordingly.