Copied to clipboard

Flag this post as spam?

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


  • Mario 130 posts 809 karma points c-trib
    Jun 25, 2020 @ 05:30
    Mario
    0

    IEnumerable empty with no reason

    This is a really strange behaviour and I hope I'm not doing anything silly here. I have this code:

    public class BlogSurfaceController : SurfaceController
    {
        [ChildActionOnly]
        public PartialViewResult ExploreMore(int size = 4)
        {
            var articles = Umbraco.ContentAtXPath("//" + Post.ModelTypeAlias);                  
    
            return PartialView("Blog/_RandomArticles", articles);
        }
    }
    

    Super simple. If I hover with the mouse over where the articles are retieved I get 4 articles. Then I hover over the articles variable in the return statement and I get an empty value then I hover over the previos=us articles again and it's empty.

    enter image description here

    I got to this issue trying to get random articles from my blog, when I iterate over the collection the script can't find any articles, but they were there!

  • Mario 130 posts 809 karma points c-trib
    Jul 01, 2020 @ 22:58
    Mario
    100

    This was solved upgrading Umbraco to v8.6.3 It's related to this bug: https://github.com/umbraco/Umbraco-CMS/issues/7798

Please Sign in or register to post replies

Write your reply to:

Draft