Copied to clipboard

Flag this post as spam?

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


  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Oct 17, 2013 @ 15:02
    Jeavon Leopold
    0

    Top most dictionary items doesn't have a parent

    Using v1.5.1 (Umbraco v6.1.6) I get the below exception why trying to add a new dictionary item at the root level, any ideas?


    Server Error in '/' Application.

    Top most dictionary items doesn't have a parent

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: Top most dictionary items doesn't have a parent

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [ArgumentException: Top most dictionary items doesn't have a parent] umbraco.cms.businesslogic.DictionaryItem.getParent() +187 jumps.umbraco.usync.SyncDictionary.DictionaryItemSaving(DictionaryItem sender, EventArgs e) +129 umbraco.cms.businesslogic.SaveEventHandler.Invoke(DictionaryItem sender, EventArgs e) +0 umbraco.cms.businesslogic.DictionaryItem.createKey(String key, Guid parentId, String defaultValue) +1197 umbraco.dictionaryTasks.Save() +283 umbraco.presentation.create.dialogHandlertemp.Create(String NodeType, Int32 TypeId, Int32 NodeId, String Text) +753 umbraco.cms.presentation.create.controls.simple.sbmtClick(Object sender, EventArgs e) +323 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

  • Kevin Jump 2310 posts 14694 karma points MVP 7x c-trib
    Oct 17, 2013 @ 15:59
    Kevin Jump
    0

    Yes it seems to be something intermittent - i saw it a few times developing but could never get to the bottom of it.

    I went around the houses with the GetTop() function trying to go up to the top of the tree (dictionary items are odd, you actualy only save the top of the tree, it saves everything in one file)

    private static Dictionary.DictionaryItem GetTop(Dictionary.DictionaryItem item)
    {
      if (!item.IsTopMostItem())
      {
        LogHelper.Debug<uSync>("is Top Most [{0}]", ()=> item.IsTopMostItem());
        if (item.Parent != null)
        {
          LogHelper.Debug<uSync>("parent [{0}]", () => item.Parent.key); 
          return GetTop(item.Parent);
        }
      }
      return item; 
    }
    

    I don't know if it's in DictionaryItem.IsTopMenuItem().. or item.Parent.key.

    I'll add some more debugging and see if i can get anyfurther

  • Kevin Jump 2310 posts 14694 karma points MVP 7x c-trib
    Oct 17, 2013 @ 16:07
    Kevin Jump
    0

    Yes looking at the code / core - I think it's because you can't test for item.Parent without the core throwing the exception for you!

    https://github.com/umbraco/Umbraco-CMS/blob/6c77749e32d9a8a6f0296953cca33acda24b68cf/src/umbraco.cms/businesslogic/Dictionary.cs

    public DictionaryItem Parent
    {
        get
        {
            EnsureCache();
            if (_parent == null)
            {
                var p = DictionaryItems.Values.SingleOrDefault(x => x.UniqueId == this.ParentId);
                if (p == null)
                {
                     throw new ArgumentException("Top most dictionary items doesn't have a parent");
                }
                else
                {
                     _parent = p;
                }
           }
    
       return _parent;
     }
    

    So for some reasons IsTopMost Returns false, then if ( item.Parent != null ) throws an exception

    I'm going to fire that is an issue.

  • Kevin Jump 2310 posts 14694 karma points MVP 7x c-trib
    Oct 17, 2013 @ 16:17
  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Oct 17, 2013 @ 19:55
    Jeavon Leopold
    0

    Awesome! Thanks Kevin!

  • Kevin Jump 2310 posts 14694 karma points MVP 7x c-trib
    Oct 17, 2013 @ 20:24
    Kevin Jump
    100

    I've released a patched version of uSync to try and capture the exception being thrown.

    v1.5.2 (now on our) - should at least not throw the error (it assumes that when the error gets thrown it's at the top of the tree (because parent is null)

  • CodeTuner 1 post 21 karma points
    Oct 30, 2013 @ 18:18
    CodeTuner
    0

    Im using uSync 1.5.2 and Umbraco 6.1.6 and I'm still having the issue...

  • David Prothero 23 posts 106 karma points
    Nov 09, 2013 @ 19:37
    David Prothero
    0

    I was having this problem on 1.5.1. Version 1.5.2 fixed it for me. Thanks Kevin.

  • Kevin Jump 2310 posts 14694 karma points MVP 7x c-trib
    Nov 17, 2013 @ 11:56
    Kevin Jump
    0

    there does appear to be one other way of triggering this error new v1.5.3 fixes the other doesn't have a parent issue that can sometimes happen (i think)

Please Sign in or register to post replies

Write your reply to:

Draft