U4-6460 - 7.2.2 -> 7.2.4 update fails with "an item with the same key has already been added" error

Created by Eric Schrepel 25 Mar 2015, 16:56:08 Updated by Sebastiaan Janssen 05 May 2015, 12:48:22

Is duplicated by: UAAS-195

Relates to: U4-6510

Following the normal upgrade procedure (copy /bin, /umbraco, /umbracoclient, compare .configs), the install process fails with the following from the UmbracoTraceLog. Full log is attached for reference. As far I know, we have no items/views/etc with duplicate names, and we don't use child document types so the "duplicate property in parent and child document types" doesn't apply.

2015-03-24 16:43:52,627 [20] ERROR Umbraco.Web.Install.Controllers.InstallApiController - [Thread 37] Installation step UmbracoVersion failed. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: An item with the same key has already been added. at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at Umbraco.Core.Services.LocalizedTextServiceFileSources.<.ctor>b__0() at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue() at Umbraco.Core.Services.LocalizedTextServiceFileSources.TryConvert2LetterCultureTo4Letter(String twoLetterCulture) at Umbraco.Core.Services.LocalizedTextService.ConvertToSupportedCultureWithRegionCode(CultureInfo currentCulture) at Umbraco.Core.Models.UserExtensions.GetUserCulture(String userLanguage, ILocalizedTextService textService) at Umbraco.Web.Security.WebSecurity.PerformLogin(IUser user) at Umbraco.Web.Install.InstallSteps.SetUmbracoVersionStep.Execute(Object model) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Umbraco.Web.Install.Controllers.InstallApiController.ExecuteStep(InstallSetupStep step, JToken instruction) at Umbraco.Web.Install.Controllers.InstallApiController.PostPerformInstall(InstallInstructions installModel) 2015-03-24 16:43:52,627 [20] INFO Umbraco.Web.Install.Controllers.InstallApiController - [Thread 37] Step completed (took 5074ms) 2015-03-24 16:43:52,627 [20] ERROR Umbraco.Web.Install.Controllers.InstallApiController - [Thread 37] An error occurred during installation step UmbracoVersion System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: An item with the same key has already been added. at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at Umbraco.Core.Services.LocalizedTextServiceFileSources.<.ctor>b__0() at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue() at Umbraco.Core.Services.LocalizedTextServiceFileSources.TryConvert2LetterCultureTo4Letter(String twoLetterCulture) at Umbraco.Core.Services.LocalizedTextService.ConvertToSupportedCultureWithRegionCode(CultureInfo currentCulture) at Umbraco.Core.Models.UserExtensions.GetUserCulture(String userLanguage, ILocalizedTextService textService) at Umbraco.Web.Security.WebSecurity.PerformLogin(IUser user) at Umbraco.Web.Install.InstallSteps.SetUmbracoVersionStep.Execute(Object model) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Umbraco.Web.Install.Controllers.InstallApiController.ExecuteStep(InstallSetupStep step, JToken instruction) at Umbraco.Web.Install.Controllers.InstallApiController.PostPerformInstall(InstallInstructions installModel)

2 Attachments

Download UmbracoTraceLog.txt

Comments

ross 05 Apr 2015, 16:56:42

I'm also having this issue, fresh installation and trying to use Microsoft SQL Server


Nicholas Westby 06 Apr 2015, 21:42:13

FYI, I just performed an upgrade of Umbraco 7.2.2 to Umbraco 7.2.4 (I had also previously upgraded from Umbraco 7.1.8 to Umbraco 7.2.2) and I didn't encounter this issue. Are you using a language other than English for your installation (I ask because I noticed your stack trace contains LocalizedTextServiceFileSources). Any chance you duplicated an item in one of the files in Umbraco/Config/Lang/*.xml when you were merging?


patrick Livbom 22 Apr 2015, 13:02:29

Just had this issue... upgraded in varous steps from 6.2.0 to 7.2.4 with contour upgrade in between.... and a lot of custom contour mods sigh Turned out there were a se.xml and a sv.xml in the umbraco config lang. removed the se and it worked like a charm


Eric Schrepel 23 Apr 2015, 00:40:34

I often have no idea why certain Umbraco "fixes" work. I tried @aikidokan approach, removing all \umbraco\config\lang*.xml files except what we use (en-us.xml), then the upgrade continued without error. Initially, all UI labels were appearing in brackets, but after the site came up and logged back in again, things look great.

So two questions: 1) do I need to add a step into further upgrades of "after copying \umbraco folder, remove all but \umbraco\config\lang\en-us.xml files" ? Or is there a way to avoid this error in the future? (This is the first upgrade where that's been an issue.)

and 2) Can the install process return more helpful errors? Because really, I still don't know why these other lang*.xml files caused any issue (they're copied afresh with each upgrade), and if Umbraco's throwing an error during the install, it'd be great to have something more handy than "duplicate key detected" cuz that could be almost anything (kudos to @Knickerbocker for interpreting the log file snippet).

Not a rant, love Umbraco, just each upgrade seems to throw something new at me.


patrick Livbom 23 Apr 2015, 05:47:09

@Eric.Schrepel I actually didnt have time to check why it worked. I did a compare of the two lang folders after a tip over at umbraco forum (about merchello, but it pointed me in this direction. Maybe the contour adds a se.xml file in the early stages (i did not create the site initially but upgraded it a year ago to 6.2 and this week to 7.2.4.) And the versions pre 7.2.4 are fine with this? Well, removing one of them helper me :)


Shannon Deminick 27 Apr 2015, 03:42:00

I've fixed this in rev: da579c91e11c335a405967702410f8ad78d55af8

However, this will avoid this issue but i think there's a deeper underlying issue. It might be that there are old language files in the install that have the wrong 'culture' attribute in their source so there might be duplicate cultures declared between files. That is really the only way that this issue can occur.


Eric Schrepel 28 Apr 2015, 16:13:49

Don't know if this is related, but having followed the tip of removing all but the main en-us.xml language file, our login screens now come up looking like the attached some of the time, but not always. (With [login_greeting2], [login_instruction] etc instead of the normal words.)


Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.2.5

Sprint:

Story Points:

Cycle: