The document comparison crashes when comparing documents with empty tables of contents.
To reproduce, create two MS Word documents with empty tables of contents.
Compare the documents using Comparer.Compare(…)
This produces the following exception:
GroupDocs.Comparison.Common.Exceptions.DocumentComparisonException
HResult=0x80131600
Message=Error occurred in comparing Word documents
Source=GroupDocs.Comparison
StackTrace:
at .([] , [] , CompareOptions , )
at .( , CompareOptions , SaveOptions )
at GroupDocs.Comparison.Comparer.(Stream , Document , Document , CompareOptions , SaveOptions , )
at GroupDocs.Comparison.Comparer.Compare(Stream document, SaveOptions saveOptions, CompareOptions compareOptions)
This code was run with GroupDocs.Comparison 23.12.0 in a .NET 6.0 console application on a Windows 11 machine:
using var comparer = new Comparer(loadPath1);
comparer.Add(loadPath2);
comparer.Compare(outputPath);
I have attached an example document that causes the crash. Compare this file with a copy of the file.
Emtpy_tableOfContents1.docx (14.0 KB)
We get no results when comparing the same documents in the online tool:
I suppose this is because of the same crash