Copied to clipboard

Flag this post as spam?

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


  • Paul Merks 35 posts 100 karma points
    Mar 27, 2020 @ 11:20
    Paul Merks
    0

    Nested Content throwing NULL reference exception

    Hi,

    Within a fresh installation of Umbraco 8.5.5, I've created a document type with nested content.

    After trying to read the elements within the nested content property (using Model.Value<>

    The nested content document type is an Element type, and in Umbraco I can fill everything as it should. In the Razor view things are not working as it should.

    Does anybody else have this problem or possibly a solution?

    This is the part that is throwing an exception:

    var slides = Model.Value<IEnumerable<IPublishedElement>>("slides");
    

    Regards,

    Paul

  • Paul Wright (suedeapple) 237 posts 633 karma points
    Mar 27, 2020 @ 12:34
    Paul Wright (suedeapple)
    0

    Have you actually got any "slides" setup in the backoffice?

  • Paul Merks 35 posts 100 karma points
    Mar 30, 2020 @ 12:19
    Paul Merks
    0

    Well, that shouldn't matter. In case I do not put any elements in the property, this still does not mean that calling this method should throw an exception. But yes, there is data in the property.

  • Paul Merks 35 posts 100 karma points
    May 28, 2020 @ 11:59
    Paul Merks
    0

    And again, today we setup new brand new Umbraco 8 installation and using nested content directly results in NULL references. Exactly as described above. What are we doing wrong and doesn't anybody else have this issue?

  • Gabor Ferencz 11 posts 101 karma points
    25 days ago
    Gabor Ferencz
    0

    Hi! I'm also getting this error when I'm accessing the property when rebuilding the index. I have a custom examine event set up for the transforming index values, and I need to get this data out. Any thoughts why this issue is occuring?

  • Gabor Ferencz 11 posts 101 karma points
    21 days ago
    Gabor Ferencz
    0

    In case anybody runs into this, I had a repository getting me my page from Umbraco using:

       using (var cref = _context.EnsureUmbracoContext())
            {
                var page = cref.UmbracoContext.Content.GetById(pageId);
                return page;
            }
    

    This grabbed me my page data, but since the context was displosed, it couldn't get my nested content data.

    I had to move all my data processing code inside of the using statement, and things started working:

Please Sign in or register to post replies

Write your reply to:

Draft