The error message generated is not sufficient to help fix the problem

Error raised when loading a .xer (Primavera) project file.

[ArgumentException: An item with the same key has already been added.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +60
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +14449535
#=z9_qq17eCpSXuAXjtEUTymPfoNi1tqfV01DZQPiMlDBMG.#=zcClHALc=() +261
#=z9_qq17eCpSXuAXjtEUTymPfoNi1tqfV01DZQPiMlDBMG.#=zihwZ$wY=() +216
#=z9_qq17eCpSXuAXjtEUTymPfoNi1tqfV01DZQPiMlDBMG.#=zpxDaXAo=() +544
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zAZ5cB_fQW$Vp7GcDNsiNxAifIJX5o8NMsw6DSMw=(Exception #=z2AnZ5Ms=) +21
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=znRGmPco5c27EWl6cWRn7c3SwaDUS(Object #=z2AnZ5Ms=) +45
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zBQWLoMJDp9BsSfbN5Rv7bAc=(MethodBase #=z2AnZ5Ms=, Boolean #=zhaeioVw=) +1161
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zkavaIV3AzgTjTQB0idBPPy9Kuk6LOHiCgA==(#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U= #=z2AnZ5Ms=, #=q_1NcxA2uaT9AT3C5GhOfdJPnyLTPmKBjAtXousv3yKY= #=zhaeioVw=) +79
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zcVkB7$pMbjviY2Ov4enmjVrp1aJN() +134
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zfc$6NrIElokkXM1PLhLULDcK9kUh(Boolean #=z2AnZ5Ms=) +164
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zAZ5cB_fQW$Vp7GcDNsiNxAifIJX5o8NMsw6DSMw=(Exception #=z2AnZ5Ms=) +21
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=znRGmPco5c27EWl6cWRn7c3SwaDUS(Object #=z2AnZ5Ms=) +45
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zed6FAcUmtjnWNJj0L5yvekoFF2AC() +63
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zJ$2C8xmzCh_gS101FAVS5CkL3PUGPAhHsc5qwR0=(Object #=z2AnZ5Ms=, UInt32 #=zhaeioVw=) +764
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zfc$6NrIElokkXM1PLhLULDcK9kUh(Boolean #=z2AnZ5Ms=) +215
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zAGqXVMoRwdt5sMpRhm23kKfyJ_audRde6qNGq2D8e$bw() +11
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zIHC8Ma4B_NODnlocIetHUDpiqbi0KJOEfMsn3ddFW2L1(Object[] #=z2AnZ5Ms=, Type[] #=zhaeioVw=, Type[] #=zyYuwx0Q=, Object[] #=z7rZu9Ic=) +397
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=z$anhM8rmVArQXhFPHM784KDojtyvEPiFqqkc8rc=(Stream #=z2AnZ5Ms=, String #=zhaeioVw=, Object[] #=zyYuwx0Q=, Type[] #=z7rZu9Ic=, Type[] #=zoIjAudQ=, Object[] #=zUhYAMDo=) +58
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zxTK80PVQ2CjJiDp8KU7_pE8=(Stream #=z2AnZ5Ms=, String #=zhaeioVw=, Object[] #=zyYuwx0Q=) +30
#=qJWZkHpVMPYhwfmGq588B1kIT2IgGV9FEFOT8Zhxp59U=.#=zEhiupn1E7ELS6e4OZvhBkeN78PSd(Stream #=z2AnZ5Ms=, String #=zhaeioVw=, Object[] #=zyYuwx0Q=) +13
#=z9_qq17eCpSXuAXjtEUTymPfoNi1tqfV01DZQPiMlDBMG.#=zpxDaXAo=(Project #=zKKDPksw=, Stream #=zMhINack=, LoadOptions #=z3U$Su6WWAFt$, #=zc_zV4sTuVgUmkVxdsjr5HhM= #=zDKtlUCk=) +170
#=zRQrf92f6sjlh0zRvsqRNXcs=.#=zpxDaXAo=(Stream #=zMhINack=, Project #=zKKDPksw=) +285
Aspose.Tasks.Project.#=zTdYw6uqkWvV6(Stream #=zMhINack=, LoadOptions #=z3U$Su6WWAFt$) +266
Aspose.Tasks.Project…ctor(String projectTemplate, ParseErrorCallback parseErrorHandler) +100
Aspose.Tasks.Project…ctor(String projectTemplate) +14

@ensemble

The error message you are encountering, “An item with the same key has already been added,” typically indicates that there is a duplicate key in a dictionary or collection when trying to load the .xer (Primavera) project file. This can happen due to various reasons, such as duplicate entries in the project data or unsupported features in the file.

To troubleshoot this issue, you can implement exception handling to capture more detailed information about the error. The TasksReadingException class provides a LogText property that can help identify the problematic section of the project file. Here’s an example of how you can handle this exception in your code:

try
{
    var project = new Project("path_to_your_file.xer");
}
catch (TasksReadingException ex)
{
    Console.WriteLine("Message: " + ex.Message);
    Console.WriteLine("Log: " + ex.LogText);
    
    if (ex.InnerException != null)
    {
        Console.WriteLine("Inner exception message: " + ex.InnerException.Message);
    }
}

In this code snippet, replace "path_to_your_file.xer" with the actual path to your Primavera file. This will help you capture the error message and any additional log information that can point to the specific issue causing the error.

If you continue to face difficulties, consider checking the structure of your .xer file for any duplicate entries or unsupported features. You may also want to refer to the documentation on handling exceptions for more insights on resolving such issues effectively.

For further assistance, you can explore the following resources:

These resources provide additional context and examples that may help you resolve the issue more effectively.

@ensemble ,
we need the following information to perform the investigation:

  1. which version of Aspose.Tasks do you use
  2. can you attach the XER file ?

Hi.
Here’s what you asked for.

  1. Version: Aspose.Task 25.5.0
  2. File: 2025-05-30_6BFR.zip (2.7 MB)

Hi.

I tried to use your approach to get more information related to the error, but this is the result:
image.jpg (219.8 KB)

Regards,

@ensemble ,
investigation shown that reading of WBS and Task entities should be fixed on our side.

@ensemble
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): TASKSNET-11485

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as TASKSNET-11485) have been fixed in this update.

Download link: https://releases.aspose.com/tasks/net/