Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gordon Saxby 1444 posts 1855 karma points
    May 24, 2017 @ 08:14
    Gordon Saxby
    0

    An item with the same key has already been added

    I have enabled Member type processing and it seems to be causing an issue - I get this error:

    An item with the same key has already been added
    

    I set "DontThrowErrors" to true and the log only reports that there was a problem:

     2017-05-24 08:06:07,031 [P7992/D5/T1] INFO  Jumoo.uSync.BackOffice.Logging - Running Import: MemberType
     2017-05-24 08:06:07,097 [P7992/D5/T1] INFO  Jumoo.uSync.BackOffice.uSyncApplicationEventHandler - No Throw errors is set, so uSync won't YSOD
     2017-05-24 08:06:07,098 [P7992/D5/T1] ERROR Jumoo.uSync.BackOffice.uSyncApplicationEventHandler - Error During Setup:
    System.ArgumentException: An item with the same key has already been added.
       at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
       at Jumoo.uSync.Core.Serializers.ContentTypeBaseSerializer`1.DeserializeProperties(IContentTypeBase item, XElement node)
       at Jumoo.uSync.Core.Serializers.MemberTypeSerializer.DeserializeCore(XElement node)
       at Jumoo.uSync.Core.Serializers.SyncBaseSerializer`1.DeSerialize(XElement node, Boolean forceUpdate)
       at Jumoo.uSync.BackOffice.Handlers.MemberTypeHandler.Import(String filePath, Boolean force)
       at Jumoo.uSync.BackOffice.Handlers.uSyncBaseHandler`1.ImportFolder(String folder, Boolean force, Dictionary`2 updates)
       at Jumoo.uSync.BackOffice.Handlers.uSyncBaseHandler`1.ImportFolder(String folder, Boolean force, Dictionary`2 updates)
       at Jumoo.uSync.BackOffice.Handlers.uSyncBaseHandler`1.ImportAll(String folder, Boolean force)
       at Jumoo.uSync.BackOffice.uSyncBackOfficeContext.Import(IEnumerable`1 syncHandlers, String folder, Boolean checkConfig, Boolean force, String groupName)
       at Jumoo.uSync.BackOffice.uSyncBackOfficeContext.Import(String groupName, String folder, Boolean force)
       at Jumoo.uSync.BackOffice.uSyncBackOfficeContext.ImportAll(String folder, Boolean force)
       at Jumoo.uSync.BackOffice.uSyncApplicationEventHandler.Setup()
    

    I am not making a lot of changes to the Member type(s) but probably will need to do some more. Also I will need to transfer this site onto other servers.

    Any ideas what is going wrong?

  • Kevin Jump 2310 posts 14694 karma points MVP 7x c-trib
    May 24, 2017 @ 08:59
    Kevin Jump
    0

    Hi

    what version of umbraco and what version of usync are you using ?

    there where some issues with the keys in member types, but that was in older versions of umbraco, so if you have the version i can go check if it was that.

    Kevin

  • Gordon Saxby 1444 posts 1855 karma points
    May 24, 2017 @ 09:02
    Gordon Saxby
    0

    It is Umbraco v7.5.11, uSync.BackOffice v3.3.2.740 and uSync.Core v5.6.2.740

  • Kevin Jump 2310 posts 14694 karma points MVP 7x c-trib
    May 24, 2017 @ 09:58
    Kevin Jump
    1

    :( not its not that (at least its not in those versions).

    There was a point when setting the key (guid) in member types didn't stick, or where always returned as all zeros, but i don't think it is that.

    if you turn on debugging (in config/log4net.config add)

      <logger name="Jumoo.uSync">
        <level value="DEBUG" />
      </logger>
    

    then you will get some more logging that might help pinpoint the property that is causing the issue.

    Looking at the code i think it could be caused by either two properties having the same key or something weird with removing properties from tabs (they are the only two dictionary items in the process).

  • Gordon Saxby 1444 posts 1855 karma points
    May 24, 2017 @ 10:00
    Gordon Saxby
    0

    Hi Kevin,

    I will try and do that as soon as I can - however this is a site that is heading for staging very soon so I can't mess around with it right now!

  • Gordon Saxby 1444 posts 1855 karma points
    Jun 08, 2017 @ 15:00
    Gordon Saxby
    0

    Hi Kevin,

    I have just tried the member update option again and got this (and much more!):

    2017-06-08 14:54:11,387 [P6060/D3/T1] DEBUG Jumoo.uSync.Core.Events - Updating Property :Member umbracoMemberPasswordRetrievalQuestion
     2017-06-08 14:54:11,387 [P6060/D3/T1] DEBUG Jumoo.uSync.Core.Events - Setting Key :df013a93-e7fb-4282-b74d-13ab5203cb5f
     2017-06-08 14:54:11,387 [P6060/D3/T1] DEBUG Jumoo.uSync.Core.Events - Item Key    :df013a93-e7fb-4282-b74d-13ab5203cb5f
     2017-06-08 14:54:11,387 [P6060/D3/T1] DEBUG Jumoo.uSync.Core.Events - Setting Property Type : Umbraco.NoEdit
     2017-06-08 14:54:11,389 [P6060/D3/T1] WARN  Jumoo.uSync.BackOffice.uSyncApplicationEventHandler - Errors during Sync: An item with the same key has already been added. mscorlib
    

    I think that field was added automatically, along with an "answer" field?

  • YESU RAJA CHINTA 22 posts 89 karma points
    Sep 12, 2020 @ 22:16
    YESU RAJA CHINTA
    0

    Gordon,

    I too have a same problem, how did you resolve the issue based on the log ?

  • Gerhard Grossberger 54 posts 178 karma points
    Jun 18, 2021 @ 08:57
    Gerhard Grossberger
    0

    I have a similar issue - I want to change an element from

      <Variations>Culture</Variations>
    

    to

      <Variations>Nothing</Variations>
    

    I tried it in the Umbraco UI and also through uSync by manually manipulating the config file. In both cases I get the error:

    Import Fail: An item with the same key has already been added.

    I don´t think it´s related to uSync but how can I change this, without having to recreate all content for that element, which is quite a lot!

    Best, Gerhard

  • Kevin Jump 2310 posts 14694 karma points MVP 7x c-trib
    Jun 18, 2021 @ 09:39
    Kevin Jump
    0

    Hi Gerhard,

    yeah that type of change - will do quite a lot internally within Umbraco.

    not only would you need to change that value in the element you would also need to change how the properties are stored within the content elements.

    so for example a vary by culture property may look like this in content

    <title>
      <Value Culture="en-gb"><![CDATA[Multi-Lang-Title]]></Value>
      <Value Culture="nl"><![CDATA[Dutch - Multi]]></Value>
    </title>
    

    while the non-variant method is

    <title>
      <Value><![CDATA[Multi-Lang-Title]]></Value>
    </title>
    

    So ideally you would want to also update those values across content too.

    Having said that uSync should let you change the property value and it will attempt to fail back the languages in the content when you do it.

    So it might be worth you turning on the debugging and see if there is anything specific that is causing the key issue, because that shouldn't happen when you change this value - its just that it does kick off a lot internal umbraco stuff and maybe its tripling up on some other bit of data somewhere.

  • Gerhard Grossberger 54 posts 178 karma points
    Jun 18, 2021 @ 13:57
    Gerhard Grossberger
    0

    Hi Gordon,

    Thanks for the reply!

    The element in question is a multinode-treepicker, not sure if that has some effect there. I´ll go into debugging and checking the details here.

  • Gerhard Grossberger 54 posts 178 karma points
    Jun 18, 2021 @ 16:17
    Gerhard Grossberger
    0

    Not much I can read from that message I get in debugging:

    System.ArgumentException: An item with the same key has already been added. at 
    enter code here`System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at 
    System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) at
    Umbraco.Core.Persistence.Repositories.Implement.ContentTypeRepositoryBase`1.RenormalizeDocumentEditedFlags(IReadOnlyCollection`1 propertyTypeIds, IReadOnlyCollection`1 contentTypeIds) in 
    D:\a\1\s\src\Umbraco.Core\Persistence\Repositories\Implement\ContentTypeRepositoryBase.cs:line 1099 at 
    Umbraco.Core.Persistence.Repositories.Implement.ContentTypeRepositoryBase`1.MovePropertyTypeVariantData(IDictionary`2 propertyTypeChanges, IEnumerable`1 impacted) in 
    D:\a\1\s\src\Umbraco.Core\Persistence\Repositories\Implement\ContentTypeRepositoryBase.cs:line 685 at 
    Umbraco.Core.Persistence.Repositories.Implement.ContentTypeRepositoryBase`1.PersistUpdatedBaseContentType(IContentTypeComposition entity) in 
    D:\a\1\s\src\Umbraco.Core\Persistence\Repositories\Implement\ContentTypeRepositoryBase.cs:line 500 at
    

    ...

    Could this be a conflict between two pages that already have data in different language versions? So Umbraco tries to merge data from all language versions, but the content "collides" and can´t be merged?

    In that case I probably need to remove content from all languages that are not EN and it should work ok.

  • Gerhard Grossberger 54 posts 178 karma points
    Jun 21, 2021 @ 14:04
    Gerhard Grossberger
    0

    Gordon put me on the track here, I ended up removing the content for all the languages except EN, and then it all worked out nicely!

    https://our.umbraco.com/forum/using-umbraco-and-getting-started/106364-can-t-change-varybyculture-on-an-already-created-documenttype

Please Sign in or register to post replies

Write your reply to:

Draft