Try Now
More in this section

Forums / Bugs & Issues / Duplicate Provider Names in Multisite

Duplicate Provider Names in Multisite

2 posts, 0 answered
  1. Alex
    Alex avatar
    2 posts
    17 Jun 2013
    01 Apr 2015
    Link to this post

    We recently spun up a multi-site instance of Sitefintiy 8.0 and encountered an issue where we were unable to enable some dynamic modules for some of the additional sites that we created.  We found that this was happening because the dynamic provider names that were being generated already existed.

    We found a workaround for this and wanted to put it out here because it looks like a possible bug with how Sitefinity is generating provider names. This had us spinning out for a few days.

    Steps to reproduce on our end:

    1) Created a DynamicModule (e.g. rotators)

    2) Went to "Manage" sites under the multisite dropdown in the admin.

    3) For one of the additional sites we selected Action > Configure Modules

    4) Enabled the DynamicModule (e.g. rotators) to the site.

    5) Save

    Result: Error, "An item with the same key has already been added"

     In Administration > Settings > Advanced > DynamicModules > Providers, I could see a listing of the providers that were already existing:

    dynamicProvider2, dynamicProvider3, 4, 8, 7.  Where some of the numeric postfixes were missing (maybe from a site or module being disabled through the multi-site settings).

    After digging into some of the sitefinity dlls I found that an internal "GenerateProviderName" (In Telerik.Sitefinity.Data.ManagerExtensions) method was adding the post fix via

    "int num = existringProviderNames.Count<string>() + 1"

    This is a problem if there are removed providers because that number will circle around and duplicate. 

    The work around for us was to add additional placeholder providers in the settings to increase this iterator. But it may be beneficial to have this logic changed to do +1 off the highest postfix and not the count.

  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    28 Oct 2016
    06 Apr 2015
    Link to this post

    Thank you for sharing this feedback, I have tested to replicate the problem where the provider names will get incorrectly named with the number suffix, however I couldn`t replicate.
    To describe the provider naming incrementation, the formula is indeed to take all existing providers count for the current module (in case Dynamic Modules) and increment the count by 1.
    The existing provider names are saved in App_Data/Sitefinity/Configuration/DynamicModulesConfig.config and the formula for increment takes the number from there and there is a check that prevents duplicates
    protected internal string GenerateProviderName(string baseProviderName, IEnumerable<string> existringProviderNames)
               var name = string.Empty;
               var index = existringProviderNames.Count() + 1;
               bool generating = true;
               while (generating)
                   name = baseProviderName + index;
                   if (!existringProviderNames.Contains(name))
                       generating = false;
               return name;
    I suppose the case where this problem have occurred is a little different from what I test so if possible please elaborate additionally on the steps to replicate the problem.
    I currently create several modules and delete one which makes the provider count
    and creating new modules updates the provider names after 5.

    Stanislav Velikov
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered