Copied to clipboard

Flag this post as spam?

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


  • Carlos Rey 13 posts 107 karma points
    Jun 15, 2022 @ 15:41
    Carlos Rey
    0

    U10 - rc5 - Multi-culture site oddities (bug?)

    Hey,

    I have a vanilla U10 site.

    Ive added en-GB & de-DE.

    Ive removed en-US and set en-GB as the default language

    Ive created 1 node at the root of the tree with 2 child nodes, all in en-GB and published.

    I then use the code below to get the root (called from a UmbracoPageController):

    using (var umbracoContextReference = _umbracoContextFactory.EnsureUmbracoContext())
    {
        var root = umbracoContextReference.UmbracoContext.Content.GetByRoute("/", false, "en-GB");
    }
    

    That works, and returns the root IPublishedContent.

    But this is where things get strange.

    root.Children has no results

    root.ChildrenForAllCultures has the two en-GB children

    Then.... If the doc type for the root node is "Site" which has a content picker property called "Error404Page" (VaryByCulture enabled), if i do :

    var siteRoot = new Site(root, _publishedValueFallback)
    

    This works to map to the concreate class, but accessing siteRoot.Error404Page throws an exception in Umbraco "Value cannot be null. (Parameter 'key1')"

    I can also confirm i get the same issue if i remove all the languages except the default en-GB, only now, siteRoot.Error404Page is null and not throwing an exception.

    I can also confirm that if i turn off "VaryByCulture" on the Error404Page property, it works fine.

    Im stumped. Is this a bug in U10 or am i doing something stupid ?

Please Sign in or register to post replies

Write your reply to:

Draft