GetReferencesToContentItems throws exception

Found in

EPiServer.CMS.Core 11.20.0

Fixed in

EPiServer.CMS.Core 11.20.3

Created

Nov 03, 2020

Updated

Feb 03, 2021

Area

CMS Core

State

Closed, Fixed and tested


Description

An exception is thrown when calling ContentRepository.GetReferencesToContent(contentReference, false)

[ArgumentException: An element with the same key already exists in the dictionary.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +59
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +675
System.Linq.Enumerable.ToDictionary(IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) +334
EPiServer.DataAbstraction.ReferenceInformation.CreateReferenceInformation(DataTable data, ILanguageBranchRepository languageBranchRepository, IPermanentLinkMapper permanentLinkMapper) +3124
EPiServer.Core.Internal.DefaultContentProvider.GetReferencesToContentItems(IEnumerable`1 contentLinks) +181
EPiServer.Core.Internal.<>c__DisplayClass45_0.<GetReferencesToContent>b__0(ContentProvider p) +89
EPiServer.Core.ContentProviderMap.Iterate(Action`1 contentProviderHandler) +144
EPiServer.Core.Internal.DefaultContentRepository.GetReferencesToContent(ContentReference contentLink, IEnumerable`1 descendents, Boolean includeDescendants) +205

Reported from https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2020/11/getreferencestocontentitems-throws-exception-after-upgrade-to-latest-cms-11-30-1-and-commerce-13-26-0/