More in this section

Forums / Developing with Sitefinity / An item with the same key has already been added

An item with the same key has already been added

2 posts, 0 answered
  1. Özkan
    Özkan avatar
    5 posts
    27 Sep 2012
    23 May 2013
    Link to this post
    Hi everybody,

    We're taking an error that's 'An item with the same key has already been added' The error appears take data from any dynamic module. We don't connect any sitefinity library. By the way our db connection string is correct. 

    Sample code : 

    public IQueryable<DynamicContent> GetDataItems()
                DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
                Type redBannersType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.MidRedSubjectBanner.RedBanners");

                // Fetch a collection of "live" and "visible" redBanners items.
                var myCollection = dynamicModuleManager.GetDataItems(redBannersType)
                    .Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible == true);

                return myCollection;

    Using sitefinity  6.0. Can somebody show me how to solve this?
    Best regards,
  2. Nadezhda Petrova
    Nadezhda Petrova avatar
    20 posts
    09 Jan 2017
    23 May 2013
    Link to this post
    Hello Özkan,

    I noticed your colleague Serhad Suluoğlu have sent a support ticket about this issue.

    This issue is caused  when you run upgrade again after the first upgrade failed. To fix this you have to run the attached script. Note that first you have to set moduleNameAttributeName to your dynamic module name in FixDynamicModulesModuleNamesControl.cs.

    Hope this helps. If you have any further problems regarding this issue, please don't hesitate to contact us again.

    Nadezhda Petrova
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered