False positives in word document compare

There a is bug when comparing documents using Aspose.Words for .NET. When you compare two documents, it produces numerous “Style Definition” revisions when none exist. It is very simple to reproduce given the attached document. Just calling the Compare method on the same document produces the revisions when we would expect none, because there are no changes between the same document. The compared documents don’t have to be the same, but are for the simplicity of reproducing the issue. This issue occurs in 26.7, but is reproducible since 26.1. When I use 25.12, this issue does not appear.

The attached document includes the before and after document, code snippet below:

// Code example: at this point the word document is loaded into a MemoryStream

docMemoryStream.Position = 0;
var compareDocument = new Document(docMemoryStream);
docMemoryStream.Position = 0;
var compareAgainstDocument = new Document(docMemoryStream);
docMemoryStream.Position = 0;

var debugId = Guid.NewGuid();
var preComparePath = Path.Combine(Path.GetTempPath(), $"AsposeCompareDebug_{debugId:N}_pre.docx");
await File.WriteAllBytesAsync(preComparePath, docMemoryStream.ToArray());

compareDocument.Compare(compareAgainstDocument, "AsposeCompareDebug", DateTime.Now);

var postComparePath = Path.Combine(Path.GetTempPath(), $"AsposeCompareDebug_{debugId:N}_post.docx");
compareDocument.Save(postComparePath);
Console.WriteLine(
	$"Aspose.Words {Aspose.Words.BuildVersionInfo.Version} self-compare produced {compareDocument.Revisions.Count} revisions; pre saved to {preComparePath}, post saved to {postComparePath}");

compare_document_bug_example.zip (22.2 KB)

@bradkram
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-29461

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 WORDSNET-29461) have been fixed in this Aspose.Words for .NET 26.9 update also available on NuGet.