Copied to clipboard

Flag this post as spam?

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


  • Mario Lopez 168 posts 958 karma points MVP 4x c-trib
    Jun 25, 2020 @ 05:30
    Mario Lopez
    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 Lopez 168 posts 958 karma points MVP 4x c-trib
    Jul 01, 2020 @ 22:58
    Mario Lopez
    100

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

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies