Unhandled exception when running docx comparison with Turkish locale

Hi, i’m running a comparison on two different docx files with Turkish locale (CurrentCulture and CurrentUICulture) set on the main thread. When I do so the following exception is thrown from GroupDocs Comparison. It appears as though an enum is being parsed with Turkish locale which is causing an exception due to the letter ‘i’ not being equal to the character in the enum definition.



“Operation ‘RetrieveChangesFromDocx’ failed: Requested value ‘ınsert’ was not found.”

at Groupdocs.Comparison.Operations.OperationExtensions.ProcessOperation[T](IOperation operation)
at Groupdocs.Comparison.Comparisons.BaseComparison.GetChanges()
at Groupdocs.Web.UI.Comparison.ComparisonService.GetChangesInternal(IComparison comparison)
at Groupdocs.Web.UI.Comparison.ComparisonService.Compare()
at Canea.Common.DocumentFormat.DocumentContentComparer.Compare(NamedFileData oldestDoc, NamedFileData newestDoc)

InnerException:
“Requested value ‘ınsert’ was not found.”

at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
at Groupdocs.Comparison.Operations.RetrieveChangesFromDocx.AddChangeInfo(CustomXmlMarkup info, Node changedNode)
at Groupdocs.Comparison.Operations.RetrieveChangesFromDocx.VisitCustomXmlMarkupStart(CustomXmlMarkup customXmlMarkup)
at Aspose.Words.Markup.CustomXmlMarkup.r3ka8zscesabkstb24kjjv9sml9wq7pw​ (DocumentVisitor )
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Markup.CustomXmlMarkup.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Markup.CustomXmlMarkup.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Body.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Section.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Document.Accept(DocumentVisitor visitor)
at Groupdocs.Comparison.Operations.RetrieveChangesFromDocx.Execute()
at Groupdocs.Comparison.Operations.OperationExtensions.ProcessOperation[T](IOperation operation)


Would appreciate your assistance with this problem.
BR

Hello Lars,


We are sorry to hear that you have such issue. To be able to reproduce this issue please share with us next:
1. Version of the Comparison library.
2. .NET FrameWork version
3. Project type (WebForms, MVC etc.)
4. Example of the Comparison code that you use
5. Examples of the documents with which you got this issue

Thank you.

Hi, we’re running Groupdocs.Web.UI.Comparison.dll v 2.3.3.0 on .NET 4.5.2 together with WebForms. Here’s our code running the comparison. You can use any documents you like. It does not seem to matter.

private ComparisonWidgetSettings GetComparisonSettings()
        {
return new ComparisonWidgetSettings
{
LicensePath = this.licensePath,
RootStoragePath = this.tempFolderPath,
ComparisonBehavior =
{
StyleChangesDetection = false, // This feature do not seem to work at the moment - bug reported to GroupDocs [2015-05-04] ~ PW
MovedContentDetection = false, // This feature is turned off due to lack of time to test its impact on CPU, and the result it produces ~ PW
SummaryPageGenerationEnabled = false, // This feature is turned off because the summary page cannot be localized, it’s been noted as a feature request [2015-05-04] ~ PW
VectorBasedPdfComparison = false
}
};
}
    public Stream Compare(<font face="Consolas"><span style="font-size: 11px; background-color: white;">byte[] oldestDoc, </span></font>byte[] newestDoc)
    {
        var comparisonService = new ComparisonService(GetComparisonSettings());
        
        var differenceStream = new MemoryStream();

        using (var oldestDataStream = new MemoryStream(oldestDoc))
        using (var newestDataSteam = new MemoryStream(newestDoc))
        {
            comparisonService.SourceFileName(oldestDoc.FileName, oldestDataStream);
            comparisonService.TargetFileName(newestDoc.FileName, newestDataSteam);

            comparisonService.Compare();
            comparisonService.Save(differenceStream);
        }

        return differenceStream;
    }</pre></div>

Hello,


Thank you for the code example. We have checked Comparison with two docx document with turkish text and your code doesn’t throw any exception .

Also we have compared same documents in a common way and it works well too.

The only thing that we have add to your code is this code line:
GroupdocsComparison.Init(GetComparisonSettings());

Just after:
var comparisonService = new ComparisonService(GetComparisonSettings());

Summarizing all these we can assume that the issue reason is in your files, since that we realy need them for testing.

Thank you.

I’m sorry for my previous statement that the files do not matter. They do. The problem only occurs if the newer version (i.e. SourceFile) has additions. I have included a proper Visual Studio project with code and sample files. If you comment the lines adding Turkish locale, the comparison works just fine.

Hello,


Thank you for the additional explanation and examples. We have reproduced your issue and we created a bug ticket (you can find it attached to the first post of this thread). Our product team will resolve it and then we will notify you here.

As a temporary solution please comment this code line:
Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo(“tr-TR”);

With out it all works well.

Sorry for the inconvenience.