Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

IList returning unexpected character

Vote:
 

id="EPiServer.CMS" version="11.15.0"

id="EPiServer.CMS.UI" version="11.25.0"

Currently have the following simple block set up:

    [ContentType(DisplayName = "Parent Item Block",
        Description = "Parent Item",
        GUID = "32BE18A5-5300-4D04-9414-3BB8E3EFFE2C",
        GroupName = "Navigation")]
    public class ParentItemBlock : BlockData
    {
        [Display(Name = "Parent Menu Title", Order = 10)]
        public virtual string ParentMenuItemTitle { get; set; }

        [Display(Name = "Parent Menu Link", Order = 30)]
        [JsonProperty]
        [JsonConverter(typeof(UrlConverter))]
        public virtual Url ParentItemLink { get; set; }

        [Display(Name = "Child Items", Description = "A collection of of child links", Order = 40)]
        [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<ChildItem>))]
        [JsonProperty]
        public virtual IList<ChildItem> ChildItems { get; set; }
    }


    public class ChildItem 
    {
        [Display(Name = "Title", Order = 10)]
        public virtual string ItemTitle { get; set; }

        [Display(Name = "Link", Order = 30)]
        public virtual string ItemLink { get; set; }

//Also tried the below instead of the above string
        //[Display(Name = "Child Menu Link", Order = 30)]
        //[JsonProperty]
        //[JsonConverter(typeof(UrlConverter))]
        //public virtual Url ChildItemLink { get; set; }
    }

    [PropertyDefinitionTypePlugIn]
    public class MegaNavigationChildItemProperty : PropertyListBase<MegaNavigationChildItem>
    {
        // Stubbed
    }

So basically a block has a couple of properties one which is a PropertyList, I have used an editor descriptor and don't think I need a backing type as its not a custom object etc.

When I add something to the List, whether its the simple 2 string props or 1 string 1 Url props I get the same following error:

#270110
Jan 17, 2022 9:54
Vote:
 

Try changing PropertyListBase to PropertyList, we used to have to do the JSON serialization ourselves but if you have a base class that's doing it I think it can cause issues now.

#270121
Jan 17, 2022 21:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.