I have tried upgrading a customer’s website from Umbraco 17.1 to 17.2, but I am getting the error:
'An item with the same key has already been added." from the DocumentUrlAliasRepository.’
For example:
System.ArgumentException: ‘An item with the same key has already been added. Key: (59240e8e-c2e8-4c07-9ab7-3444ac258856, 2, foelelser)’
If I completely remove this content page, and delete all traces in the database, I just get the same error on another page.
It seems to happen in the DocumentUrlAliasRepository on the Save() method, when trying to call ToDictionary() on the IEnumerable aliases.
I will paste the error details below.
```
System.ArgumentException
HResult=0x80070057
Message=An item with the same key has already been added. Key: (59240e8e-c2e8-4c07-9ab7-3444ac258856, 2, foelelser)
Source=System.Private.CoreLib
StackTrace:
at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException[T](T key)
at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value)
at System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable1 source, Func2 keySelector, IEqualityComparer1 comparer) at System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable1 source, Func2 keySelector) at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.DocumentUrlAliasRepository.Save(IEnumerable1 aliases)
at Umbraco.Cms.Core.Services.DocumentUrlAliasService.d__23.MoveNext()
at Umbraco.Cms.Core.Services.DocumentUrlAliasService.d__15.MoveNext()
at Umbraco.Cms.Core.Services.DocumentUrlAliasServiceInitializerNotificationHandler.d__3.MoveNext()
at Umbraco.Cms.Core.Events.INotificationAsyncHandler1.<HandleAsync>d__1.MoveNext() at Umbraco.Cms.Core.Events.EventAggregator.<PublishCoreAsync>d__131.MoveNext()
at Umbraco.Cms.Core.Events.NotificationAsyncHandlerWrapperImpl1.<HandleAsync>d__02.MoveNext()
at Umbraco.Cms.Core.Events.EventAggregator.d__112.MoveNext() at Umbraco.Cms.Core.Events.EventAggregator.<PublishAsync>d__32.MoveNext()
at Umbraco.Cms.Core.Events.EventAggregator.d__2`1.MoveNext()
at Umbraco.Cms.Infrastructure.Runtime.CoreRuntime.d__20.MoveNext()
at Umbraco.Cms.Infrastructure.Runtime.CoreRuntime.d__17.MoveNext()
at Umbraco.Extensions.WebApplicationExtensions.d__0.MoveNext()
at Program.<$>d__0.MoveNext() in C:\Solutions\bfa\src\BFA.App\Program.cs:line 65
at Program.(String args)
```