C# .Net 6, Aspose for words 23.6
We receive the following sporadic exception when processing some DOCX files. the issue reproduces for some documents on some runs, but then passing the same document again goes through ok.
Unfortunately I can’t share the doc, but I think (hope) you may be able to understand the problem from the stack trace.
stack trace:
System.AggregateException: One or more errors occurred. (An item with the same key has already been added. Key: Default Paragraph Font (Parameter 'key'))
---> System.ArgumentException: An item with the same key has already been added. Key: Default Paragraph Font (Parameter 'key')
at System.Collections.Generic.SortedList`2.Add(TKey key, TValue value)
at Aspose.Words.StyleCollection.c(Style a)
at Aspose.Words.StyleCollection.a(Style a, Xja b, Style c)
at Aspose.Words.StyleCollection.b(Xja a, Style b)
at Aspose.Words.StyleCollection.c(Xja a, Style b)
at Aspose.Words.StyleCollection.a(Xja a, Style b)
at Aspose.Words.StyleCollection.d(Style a)
at Aspose.Words.StyleCollection.a(Int32 a, Boolean b)
at Aspose.Words.StyleCollection.a(StyleIdentifier a, String b)
at Aspose.Words.StyleCollection.d()
at Aspose.Words.Document.EnsureMinimum()
at Aspose.Words.DocumentBuilder.a(Int32 a, StoryType b, Int32 c, Int32 d)
at Aspose.Words.DocumentBuilder.MoveToDocumentStart()
at Aspose.Words.DocumentBuilder.set_Document(Document value)
at Aspose.Words.DocumentBuilder..ctor(Document doc)
at Wea.a(Jea a, zea b, String c, Boolean d)
at Jea.a(Int32 a, String b)
at
... (our code from here).
the code that triggers this exception loads the document and then iterates through the doc elements.
[internal ref: ncp-3205]
Thanks,
Oren