Copied to clipboard

Flag this post as spam?

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


  • John 79 posts 115 karma points
    Feb 23, 2012 @ 11:35
    John
    0

    "Value cannot be null" error after adding property to existing document type

     

    We added a new property  ("interestedInLinks") to one of our document types.  This was of type "Related Links" which uses a slightly modified version of the uComponents related links render control.

    However, when we Courier the change across to our test site, we get the following error when we click any documents that contain this new property:

    Value cannot be null.
    Parameter name: Property interestedInLinks (138) on Content Type StandardContent could not be retrieved for Document 1186 on Tab Page Related Items. To fix this problem, delete the property and recreate it.

    We were getting an Object Reference Not Set... error the first time we tried (on 4.7.0.0).  We haven't yet ugpraded to 4.7.1.1 due to a lack of time for us to investigate the breaking changes it introduces.  But I tried doing this in my dev site anyway which is where I got the more helpful error.

    Republishing the node "fixed" the problem, but this isn't really an acceptable fix when we go live - we can't guarantee that all pages iwll be in a suitable state for publishing.

    I don't think it's a Courier thing, as such, although we don't seem to have the issue when we use the Umbraco admin site to create the property.  (As a side-note, we are on Courier 2.1 I think, as we're having all sorts of issues with version 2.5)

    I had a rummage around the Umbraco source code and think I've found the offending line.(in ContentControl.cs).  Not sure if I can link to the file directly, but this is the code:

     

                        // table.Rows.Add(addControl(_content.getProperty(editPropertyType.Alias), tp));
                        var property = _content.getProperty(propertyType);
                        if (property != null && tabPage != null)
                        {
                            addControlNew(property, tabPage, tab.Caption);
    
                            // adding this check, as we occasionally get an already in dictionary error, though not sure why
                            if (!inTab.ContainsKey(propertyType.Id.ToString()))
                                inTab.Add(propertyType.Id.ToString(), true);
                        }
                        else
                        {
                            throw new ArgumentNullException(string.Format("Property {0} ({1}) on Content Type {2} could not be retrieved for Document {3} on Tab Page {4}. To fix this problem, delete the property and recreate it.", propertyType.Alias, propertyType.Id, _content.ContentType.Alias, _content.Id, tab.Caption));
                        }
    

     

    Could this be fixed by checking if the property is null and, if it is, instantiating a new instance of it rather than throwing an exception?

    John

     

     

     

  • Mysterious 27 posts 47 karma points
    Feb 27, 2012 @ 13:12
    Mysterious
    0

    Hello,

    I am facing the same problem here, I don't know what has changed, but it was working before, I think there was a problem when I uploaded the database to the remote server as I am not having this bug on my development machine, but only on the remote server, I deleted the document and re created it and refereshed the index of Examine and now it is working fine again

Please Sign in or register to post replies

Write your reply to:

Draft