TaxonomyService GetTermSets Failed to compare two elements in the array


This issue happed on a SharePoint 2013 environment that got upgraded from SharePoint 2010 and the farm includes Language Packs (Dutch in our case). When navigating to the Term Store Management Tool it is impossible to expand the Term Group “Search Dictionaries” for the non-English language. This system group is created for the Search Service Application and contains dictionaries for Company Inclusions, Company Exclusions, Query Spelling Inclusions and Query Spelling Exclusions, but the Term Sets are only provisioned for LCID 1033 (English) and that’s causing the issue.

Search Dictionaries Term Group

 

When Dutch is selected we get ‘Deze bewerking kan niet worden voltooid. Het termenarchief is mogelijk niet beschikbaar’.

Message from webpage – Deze bewerking kan niet worden voltooid. Het termenarchief is mogelijk niet beschikbaar

Failed to compare two elements in the array. 
at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)   
at System.Collections.Generic.List`1.Sort(Int32 index, Int32 count, IComparer`1 comparer)   
at Microsoft.SharePoint.Taxonomy.TermSetCollection.CreateTermSetCollection(List`1 sharedTermSets, TermStore termStore)   
at Microsoft.SharePoint.Taxonomy.WebServices.TaxonomyInternalService.GetTermSets(Guid sspId, Guid guid, Boolean includeNoneTaggableTermset, Guid webId, Guid listId, Int32 lcid)

Related: http://sharepoint-community.net/profiles/blogs/upgrade-sharepoint-2010-to-2013-metadata-service-application

 

There seems to be no easy way to rename or add a localized name for a system Term Set, but we can make use of reflection and call Microsoft.SharePoint.Taxonomy.TermSet.SetName(string value, int lcid)

In a PowerShell script that might look like this:

asnp Microsoft.SharePoint.PowerShell -ea 0 | Out-Null cls # Functions function Get-InstanceFieldNonPublic($obj, $name) { $t = $obj.GetType() $result = $t.InvokeMember($name, 'GetField, Instance, NonPublic', $null, $obj, $null) return $result } function Invoke-InstanceMethodNonPublic($obj, $name, $params) { $t = $obj.GetType() $result = $t.InvokeMember($name, 'InvokeMethod, Instance, NonPublic', $null, $obj, $params) return $result } ### INIT $tSession = Get-SPTaxonomySession -Site "http://intranet" $tStore = $tSession.TermStores[0] $tGroup = $tStore.Groups["Search Dictionaries"] $tGroup.TermSets | % { $tSet = $_ # 'Add' another language label for TermSet -- 1043 is Dutch Invoke-InstanceMethodNonPublic -obj $tSet -name "SetName" -params @($tSet.Name, 1043) # Query known language labels for TermSet Get-InstanceFieldNonPublic -obj $tSet -name "names" } # Commit changnes -- uncomment to apply # $tStore.CommitAll()

As always; be careful with reflection as it is not supported and allows you to harm your environment beyond repair. That said it did nicely resolve the issue.

 


Links to this post

Comments

CAPTCHA Image Validation