EmptyValueException: 'ModDate value is empty' is thrown on Document.Save in parallel scenario

Issue. The following exception is thrown by Document.Save(string) method if 2 documents are processed simultaneously:

Aspose.Pdf.EmptyValueException: 'ModDate value is empty'.

Code

File.Copy("sample.pdf", "sample-copy.pdf", true);
Task.WaitAll(
    Task.Run(() => Test(@"sample.pdf")),
    Task.Run(() => Test(@"sample-copy.pdf"))
);

static void Test(string path)
{
    var outputPath = path + "-output.pdf";
    var pdf = new Document(path);

    try
    {
        pdf.Info.Remove("ModDate");
        pdf.Save(outputPath);
    }
    finally
    {
        if (File.Exists(outputPath)) File.Delete(outputPath);
    }
}

sample.pdf (89.8 KB)

Thanks.

For internal reference: MDP-10125.

@licenses

We need to further investigate this scenario in details and for the purpose, we have logged an investigation ticket as PDFNET-48710 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.