Duplicate bookmarks in doc.Range.Bookmarks collection

We have a .Net 4.6.1 project. We load a .docx (that contains some AltChunks) into an Aspose.Words document.

Processed with Aspose.Words v23.6 (and v23.7) we have no issues. If we inspect the bookmark collection we see bookmarks named:

_Hlk109048958
_Hlk109048958_0

However, when process with Aspose.Words v23.8+ if we inspect the bookmark collection we see (duplicated) bookmarks named:

_Hlk109048958
_Hlk109048958

Here is the code to repro from a console application (and the source data is attached to this post). From Words v23.8 onward the ToDictionary method will throw:

 static void Main(string[] args)
 {
     License lic = new License();
     lic.SetLicense("Aspose.Words.lic");

     using (MemoryStream memStr = new MemoryStream())
     {
         byte[] content = Resource1.asposeissue;

         memStr.Write(content, 0, content.Length);

         Document wordDocument = new Document(memStr);
        
         var bookmarksDictionary = wordDocument.Range.Bookmarks.ToDictionary(x => x.Name, x => x);
     }

 }

asposeissue.docx (872.2 KB)

@NotScott It looks like the behavior is expected. The changes were made in 23.4 version (WORDSNET-24897). MS Word preserves duplicate bookmark names in different building blocks. So, Aspose.Words does the same.

Do you have any explanation for why we don’t see this issue until we use v23.8 (v23.6 processes this document w/o issue, so that doesn’t line up with the changes causing our issue being introduced in v23.4)

@NotScott
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): WORDSNET-27610

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.

We have paid support Someone will be reaching out. Thank you.

@NotScott You should post the issues in the paid support helpdesk. Then my colleagues from paid support will rise priority of the defects in our defect tracking system.

Can you provide any insight into whether this bug/issue is going to be picked up or not?

@NotScott The issue is already resolved in the current codebase. The fix will be included into the next 25.1 version of Aspose.Words. It will be released at the beginning of the next year.

TYVM for the update.

1 Like