question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in PostModel after upgrading to 7.6.0 - GetPropertyValue<string> returns "System.String[]"

See original GitHub issue

So, I just upgraded my blog to 7.6.0 and noticed that tags and categories in the PostModel are not being deserialized correctly: articulatetagserror

It seems that public static T GetPropertyValue<T>(this IPublishedContent content, string alias) was changed to return the .ToString() method of the already parsed array (Umbraco no longer returns a comma separated string).

Fix for now:

@{
    var categories = Model.GetPropertyValue<IEnumerable<string>>("categories");
    if (categories != null)
    {
        var categoriesList = categories.ToList();
        foreach (var category in categoriesList)
        {
            <a href="@Url.ArticulateCategoryUrl(Model, category)">@category</a>
            if (category != categoriesList.Last())
            {
                <span>, </span>
            } 
        }
    }
}

Use Model.GetPropertyValue<IEnumerable<string>>("categories") (or tags) instead of Model.Tags or Model.Categories.

My Setup

I’ve installed Articulate as local package on my local machine, then referenced the required dlls as project dependency, included the App_plugins/Articulate folder in source control and used uSync to sync to my blog. It’s not being displayed as installed package, but everything has been working fine for about a year now.

FYI:

I’ve noticed that there have also been changes to how MediaPicker properties are returned. GetPropertyValue<int>("profilePicture") did no longer return the id of the media item, so I had to use this.GetPropertyValue<IPublishedContent>("profilePicture").Id. I’m not sure if this is used somewhere in Articulate, but it might be of interest and related to this issue.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
GeorgDanglcommented, May 5, 2017

Thank you, that’s now much clearer!

1reaction
Shazwazzacommented, May 4, 2017

This might be due to the new property value converters, you can try to disable them and see what happens (they will be disabled by default for Upgrades, but for new installations they are enabled by default)

http://issues.umbraco.org/issue/U4-7318

https://github.com/umbraco/Umbraco-CMS/blob/dev-v7.6/src/Umbraco.Web.UI/config/umbracoSettings.Release.config#L60

This is odd because my own site is running 7.6 and works fine

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found