Copied to clipboard

Flag this post as spam?

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


  • Leroy Meijer 5 posts 25 karma points
    Feb 20, 2014 @ 13:51
    Leroy Meijer
    0

    An item with the same key has already been added.

    I have just installed Newsletter Studio 1.4.4 on Umbraco 6.1.6 which also includes ucommerce 5.1.0.13354

    The whole installation process went fine and nothing strange, but then I wanted to click on Newsletter in the bottom section. This also works good, but then when I click Settings it says: 

    An item with the same key has already been added.

    Here the whole error from the app_data/logs:

    2014-02-20 13:49:06,088 [31] ERROR Umbraco.Core.UmbracoApplicationBase - [Thread 83] An unhandled exception occurred
    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: An item with the same key has already been added.
       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
       at NewsletterStudio.Bll.UmbracoTemplatesFacade.GetAll()
       at NewsletterStudio.Pages.Settings.LoadCbListTemplates(String allowedTemplatesForRenderUrl)
       at NewsletterStudio.Pages.Settings.LoadSettings()
       at NewsletterStudio.Pages.Settings.Page_Load(Object sender, EventArgs e)
       at umbraco.BasePages.BasePage.OnLoad(EventArgs e)
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.HandleError(Exception e)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest()
       at System.Web.UI.Page.ProcessRequest(HttpContext context)
       at ASP.umbraco_newsletterstudio_pages_settings_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\0f5d5225\ff447c10\App_Web_settings.aspx.1d10c459.unh2fdqw.0.cs:line 0
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    Am I missing something? I can't seem to figure out which key is already added, also when I click mailing lists I get the exacte same error!

     

    Hope to hear from you guys ;)

    Gr. Leroy

  • Markus Johansson 1924 posts 5831 karma points MVP c-trib
    Feb 23, 2014 @ 16:55
    Markus Johansson
    0

    Hmm. Maybe something with the templates. Do you have two templates with the same name but different aliases?

  • Leroy Meijer 5 posts 25 karma points
    Feb 24, 2014 @ 09:08
    Leroy Meijer
    0

    Hi Markus,

    No I don't!

    I have just checked all templates but none have what you described! What could it further be? Are the templates of newsletter also taken in to this? So if my website node called nl-NL and a mail template is called nl-nl could it be this? Just changed the name but still doesn't work! Hmmmm, before the install everything worked fine, it still does except for newsletter, so I think I have to search it there?

    Gr. Leroy

  • Markus Johansson 1924 posts 5831 karma points MVP c-trib
    Feb 24, 2014 @ 09:46
    Markus Johansson
    0

    Hi!

    This part indicated that it's trying to add an item to the list that has the same name as another item in the list.

    System.ArgumentException: An item with the same key has already been added.
    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
    at NewsletterStudio.Bll.UmbracoTemplatesFacade.GetAll() 

    This method is implemented like this:

    Dictionary<string,string> templates = new Dictionary<string, string>();
    foreach (var template in Template.GetAllAsList())
    {
     templates.Add(template.Alias, template.Text);
    }
    return templates;

    So I guess that Template.GetAllAsList() returns two items with the same alias? Could you check that!?

  • Leroy Meijer 5 posts 25 karma points
    Feb 24, 2014 @ 09:53
    Leroy Meijer
    0

    Hi Markus,

    Thanks for the reply :) But I can't seem to find this piece of code in my own project? Where do I check Template.GetAllAsList()?

     

    Got it! It indeed seems a template is loaded twice! I will keep you posted!

     

    Leroy

  • Markus Johansson 1924 posts 5831 karma points MVP c-trib
    Feb 24, 2014 @ 10:21
    Markus Johansson
    0

    The Template.GetAllAsList() is a core-class in Umbraco. You'll probably find it in one of these namespaces:

    using umbraco.BusinessLogic;

    using umbraco.cms.businesslogic.web; 

  • Leroy Meijer 5 posts 25 karma points
    Feb 24, 2014 @ 10:32
    Leroy Meijer
    0

    Yes that did it ;) I now have my settings ;) For some reason the view Logout was added twice in: Settings -> Templates,  I couldn't delete either of them before changing a name of one of them which solved the problem!

     

    Thanks!

  • Markus Johansson 1924 posts 5831 karma points MVP c-trib
    Feb 24, 2014 @ 10:36
    Markus Johansson
    0

    Hi!

    I see! Great to hear that you've solved the problem!

    / m 

Please Sign in or register to post replies

Write your reply to:

Draft