Comparing Word Documents Hanging

When comparing 2 word documents, the function call never finishes.

Attached the 2 files being compared. Deleting the checkboxes on Page 3 seems to solve the issue.


My Code:

using System;
using System.IO;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;

namespace DocumentComparisonApp
{
public class DocumentComparer
{

public static void Main(string[] args)
{
//Load the original Word document.
using FileStream originalDocumentStream = new FileStream("1.docx", FileMode.Open, FileAccess.Read);
using WordDocument originalDocument = new WordDocument(originalDocumentStream, FormatType.Docx);

//Load the revised Word document.
using FileStream revisedDocumentStream = new FileStream("2.docx", FileMode.Open, FileAccess.Read);
using WordDocument revisedDocument = new WordDocument(revisedDocumentStream, FormatType.Docx);


Console.WriteLine("Comparison started");
//Compare the original and revised Word documents.
originalDocument.Compare(revisedDocument);
Console.WriteLine("Comparison completed");

//Save the Word document.
using FileStream outputDocumentStream = new FileStream("Result.docx", FileMode.Create, FileAccess.ReadWrite);
originalDocument.Save(outputDocumentStream, FormatType.Docx);
}
}
}



Attachment: 1_ac5fbcca.zip

10 Replies

DS Dharanya Sakthivel Syncfusion Team August 12, 2024 06:28 AM UTC

Hi Robert,

We have reproduced the reported problem “Word document comparison hangs when checkboxes are present” in our end. We will validate this issue and update you with more details on 14th August 2024.

Regards,
Dharanya.



DS Dharanya Sakthivel Syncfusion Team August 14, 2024 11:36 AM UTC

Robert,

We have confirmed that the reported issue with "Hanging issue occurs while calling Compare API” is a defect and we have logged a defect report. We will include the fix for this defect in our weekly NuGet release, which is estimated to be available on 3rd September 2024.

The status of this bug can be tracked through the below link:
Hanging issue occurs while calling Compare API in ASP.NET Core | Feedback Portal (syncfusion.com)

Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.

Regards,
Dharanya.




DA Dharanitharan Ayyasamy Syncfusion Team September 3, 2024 12:44 PM UTC

Robert, we regret not including the fix for the issue with "Word document comparison hangs when checkboxes are present" in our latest weekly NuGet release (v26.2.12). We are currently working on this and will include the fix in our upcoming weekly NuGet release scheduled for 10th September 2024. We regret any inconvenience this may cause.

The status of this bug can be tracked through the feedback link.

Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.



DA Dharanitharan Ayyasamy Syncfusion Team September 10, 2024 01:01 PM UTC

Robert, as we have promised earlier, we have included the fix for the reported issue with “Word document comparison hangs when checkboxes are presentin our latest weekly NuGet release (v26.2.14).

Root cause of the issue:
Document has continuous empty text ranges and check box. So the reported issue occurs.

Please use the below link to download our latest weekly NuGet:
Syncfusion.DocIO.Net.Core

The status of this bug can be tracked through the
feedback link.

Note: We will include this fix in our 2024 Volume 3 release, which will be available at the mid of September 2024.



RM Robert Muresan September 16, 2024 01:18 AM UTC

I am still having issues:

Adding compareOptions.DetectFormatChanges = false causes an error. I am using the same files that I attached at the start of this thread.

using System;
using System.IO;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;

namespace DocumentComparisonApp
{
public class DocumentComparer
{

public static void Main(string[] args)
{
//Load the original Word document.
using FileStream originalDocumentStream = new FileStream("1.docx", FileMode.Open, FileAccess.Read);
using WordDocument originalDocument = new WordDocument(originalDocumentStream, FormatType.Docx);

//Load the revised Word document.
using FileStream revisedDocumentStream = new FileStream("2.docx", FileMode.Open, FileAccess.Read);
using WordDocument revisedDocument = new WordDocument(revisedDocumentStream, FormatType.Docx);


Console.WriteLine("Comparison started");
ComparisonOptions compareOptions = new ComparisonOptions();
compareOptions.DetectFormatChanges = false;

originalDocument.Compare(revisedDocument, "Syncfusion", DateTime.Now, compareOptions);
Console.WriteLine("Comparison completed");

//Save the Word document.
using FileStream outputDocumentStream = new FileStream("Result.docx", FileMode.Create, FileAccess.ReadWrite);
originalDocument.Save(outputDocumentStream, FormatType.Docx);
}
}
}




RM Robert Muresan September 16, 2024 01:24 AM UTC

I am also having issues running this code with these 2 files. I have attached the 2 files to compare.

This missing functionality is blocking me, I was not able to find a quick workaround. If you find a fast workaround, could you let me know?


Code:

using System;
using System.IO;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;

namespace DocumentComparisonApp
{
public class DocumentComparer
{

public static void Main(string[] args)
{
//Load the original Word document.
using FileStream originalDocumentStream = new FileStream("1.docx", FileMode.Open, FileAccess.Read);
using WordDocument originalDocument = new WordDocument(originalDocumentStream, FormatType.Docx);

//Load the revised Word document.
using FileStream revisedDocumentStream = new FileStream("2.docx", FileMode.Open, FileAccess.Read);
using WordDocument revisedDocument = new WordDocument(revisedDocumentStream, FormatType.Docx);


Console.WriteLine("Comparison started");
//Compare the original and revised Word documents.
originalDocument.Compare(revisedDocument);
Console.WriteLine("Comparison completed");

//Save the Word document.
using FileStream outputDocumentStream = new FileStream("Result.docx", FileMode.Create, FileAccess.ReadWrite);
originalDocument.Save(outputDocumentStream, FormatType.Docx);
}
}
}

Attachment: a_45fafa9a.zip


DS Dharanya Sakthivel Syncfusion Team September 16, 2024 04:51 PM UTC

Robert,

We have reproduced the reported problems “System.NullReferenceException thrown while compare documents” and “System.ArgumentOutOfRangeException thrown while compare documents” in our end. We will validate this issue and update you with more details on 18th August 2024.

Regards,
Dharanya.



DS Dharanya Sakthivel Syncfusion Team September 17, 2024 04:02 PM UTC

Robert,

Apologies for the confusion in my previous message. I mistakenly mentioned 18th August 2024. The correct date for providing an update on the reported issues, “System.NullReferenceException thrown while comparing documents” and “System.ArgumentOutOfRangeException thrown while comparing documents,” on Tomorrow (18th September 2024).

Regards,
Dharanya.




DS Dharanya Sakthivel Syncfusion Team September 18, 2024 03:25 PM UTC

Robert,

We have confirmed that the reported issue with “NullReferenceException throws while comparing documents with DetectFormatChanges API disabled” is a defect and we have logged a defect report. We will include the fix for this defect in our weekly NuGet release, which is estimated to be available on 8th October 2024.

The status of this bug can be tracked through the below link:
NullReferenceException throws while comparing documents with DetectFormatChanges API disabled in ASP.NET Core | Feedback Portal (syncfusion.com)

We have confirmed that the reported issue with “ArgumentOutOfRangeException throws while comparing documents with DetectFormatChanges API disabled” is a defect and we have logged a defect report. We will include the fix for this defect in our weekly NuGet release, which is estimated to be available on 8th October 2024.

The status of this bug can be tracked through the below link:
ArgumentOutOfRangeException throws while comparing documents with DetectFormatChanges API disabled in ASP.NET Core | Feedback Portal (syncfusion.com)

Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.

Regards,
Dharanya.




DA Dharanitharan Ayyasamy Syncfusion Team October 8, 2024 11:34 AM UTC

Robert,

Regarding “NullReferenceException throws while comparing documents with DetectFormatChanges API disabled”:

As we have promised earlier,
we have included the fix for the reported issue with “NullReferenceException throws while comparing documents with DetectFormatChanges API disabledin our latest weekly NuGet release (v27.1.52).

Root cause of the issue:
The document contains a custom style applied to the paragraph. Typically, custom styles are identified using a custom tag, but in this case, the document contains a custom style without the tag, which causes the issue.

The status of this bug can be tracked through the
feedback link.

Regarding “ArgumentOutOfRangeException throws while comparing documents with DetectFormatChanges API disabled”:

As we have promised earlier, we have included the fix for the reported issue with “ArgumentOutOfRangeException throws while comparing documents with DetectFormatChanges API disabledin our latest weekly NuGet release (v27.1.52).

Root cause of the issue:
The document contains multiple bookmarks across different paragraphs. So during comparison, bookmarks are not handled properly causing an issue.

The status of this bug can be tracked through the
feedback link.

Please use the below link to download our latest weekly NuGet:
Syncfusion.DocIORenderer.Net.Core

Note: We will include this fix in our 2024 Volume 4 release, which will be available at the second week of December 2024.


Loader.
Up arrow icon