Copied to clipboard

Flag this post as spam?

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


  • Jesse Andrews 191 posts 716 karma points c-trib
    Mar 20, 2018 @ 23:03
    Jesse Andrews
    0

    LeBlender mapper throws InvalidCastException on content save

    Umbraco: 7.8.1

    Leblender: 1.0.9.2

    uSync: 4.0.4

    uSync.ContentEdition: 4.1.1

    I've encountered a bug with the LeBlender content mapper. I encountered the following exception when saving a content node

    Jumoo.uSync.Content.ContentHandler - Error saving Content: System.InvalidCastException: Cannot cast Newtonsoft.Json.Linq.JObject to Newtonsoft.Json.Linq.JToken.
       at Newtonsoft.Json.Linq.Extensions.Convert[T,U](T token)
       at Newtonsoft.Json.Linq.JToken.Value[T](Object key)
       at Jumoo.uSync.ContentMappers.LeBlenderContentMapper.MapLeBlenderValue(Int32 dataTypeDefinitionId, String value, Boolean import)
       at Jumoo.uSync.ContentMappers.LeBlenderContentMapper.GetExportValue(Int32 dataTypeDefinitionId, String value)
       at Jumoo.uSync.Core.Mappers.GridMapper.ProcessControl(JObject control, Boolean import)
       at Jumoo.uSync.Core.Mappers.GridMapper.ProcessGrid(String content, Boolean import)
       at Jumoo.uSync.Core.Mappers.GridMapper.GetExportValue(Int32 dataTypeDefinitionId, String value)
       at Jumoo.uSync.Core.Serializers.ContentBaseSerializer`1.GetExportIds(PropertyType propType, XElement value)
       at Jumoo.uSync.Core.Serializers.ContentBaseSerializer`1.SerializeBase(IContentBase item, String contentTypeAlias)
       at Jumoo.uSync.Core.Serializers.ContentSerializer.SerializeCore(IContent item)
       at Jumoo.uSync.Core.Serializers.SyncBaseSerializer`1.Serialize(T item)
       at Jumoo.uSync.Content.ContentHandler.ExportItem(IContent item, String path, String rootFolder)
    

    We do have some custom datatypes inside the leblender widgets, but nothing that should cause parsing issues. See the following json snippets from the grid property.

    This one fails.

    {
        "name":"1 column layout",
        "sections":[
            {
                "grid":12,
                "rows":[
                    {
                        "name":"1 Column",
                        "areas":[
                            {
                                "grid":12,
                                "allowAll":false,
                                "allowed":[
                                    "rte",
                                    "media",
                                    "macro",
                                    "embed",
                                    "banner",
                                    "breadcrumb",
                                    "divider",
                                    "summaryTiles",
                                    "categoryStickyNav",
                                    "categoryIntro",
                                    "productListing",
                                    "cta",
                                    "linkedList",
                                    "summaryFeed",
                                    "productGroupIntro",
                                    "contentSummary",
                                    "folderLinks",
                                    "featuredContent",
                                    "librarySummaryFeed",
                                    "libraryFilter",
                                    "relatedContent",
                                    "sectionSummaries",
                                    "steps",
                                    "libraryNavigation",
                                    "sectionCtas",
                                    "hubspotForm",
                                    "imageSet",
                                    "backgroundImage",
                                    "wistiaEmbed",
                                    "testimonials",
                                    "iconBlurbSet",
                                    "latestNews",
                                    "productRelatedContent",
                                    "dividerV2",
                                    "summaryTilesSimplified",
                                    "feed",
                                    "productUseCases",
                                    "contacts",
                                    "siblingNavigation",
                                    "contentIntro",
                                    "careersEmbed",
                                    "simpleCTA",
                                    "productThemes",
                                    "newsFilter",
                                    "contactForm",
                                    "paymentForm",
                                    "wordArtImage"
                                ],
                                "config":{
    
                                },
                                "styles":{
    
                                },
                                "hasConfig":false,
                                "controls":[
                                    {
                                        "value":[
                                            {
                                                "customerStories":{
                                                    "value":"2195,2196,2197,2198,2199,2203",
                                                    "dataTypeGuid":"f908de8f-cff2-4de8-a58b-baf8115844aa",
                                                    "editorAlias":"customerStories",
                                                    "editorName":"Customer Stories"
                                                },
                                                "link":{
                                                    "value":{
                                                        "mode":"internal",
                                                        "label":"Test",
                                                        "target":1186
                                                    },
                                                    "dataTypeGuid":"fd61907d-0c22-4a91-ba41-5a06d750fbaf",
                                                    "editorAlias":"link",
                                                    "editorName":"Link"
                                                },
                                                "small":{
                                                    "value":3,
                                                    "dataTypeGuid":"2e6d3631-066e-44b8-aec4-96f09099b2b5",
                                                    "editorAlias":"small",
                                                    "editorName":"Small"
                                                },
                                                "medium":{
                                                    "value":5,
                                                    "dataTypeGuid":"2e6d3631-066e-44b8-aec4-96f09099b2b5",
                                                    "editorAlias":"medium",
                                                    "editorName":"Medium"
                                                },
                                                "large":{
                                                    "value":7,
                                                    "dataTypeGuid":"2e6d3631-066e-44b8-aec4-96f09099b2b5",
                                                    "editorAlias":"large",
                                                    "editorName":"Large"
                                                }
                                            }
                                        ],
                                        "editor":{
                                            "alias":"feed"
                                        },
                                        "active":true,
                                        "guid":"21e9a53e-9735-4ccf-b223-32020aa2c702"
                                    }
                                ],
                                "hasActiveChild":true,
                                "active":true
                            }
                        ],
                        "styles":{
    
                        },
                        "config":{
                            "fullWidth":"1"
                        },
                        "hasConfig":true,
                        "id":"a1a9d807-311e-835b-04a3-dc01704184f3",
                        "hasActiveChild":true,
                        "active":true
                    }
                ]
            }
        ]
    }
    

    but this one works.

    {
        "name":"1 column layout",
        "sections":[
            {
                "grid":12,
                "rows":[
                    {
                        "name":"1 Column",
                        "areas":[
                            {
                                "grid":12,
                                "allowAll":false,
                                "allowed":[
                                    "rte",
                                    "media",
                                    "macro",
                                    "embed",
                                    "banner",
                                    "breadcrumb",
                                    "divider",
                                    "summaryTiles",
                                    "categoryStickyNav",
                                    "categoryIntro",
                                    "productListing",
                                    "cta",
                                    "linkedList",
                                    "summaryFeed",
                                    "productGroupIntro",
                                    "contentSummary",
                                    "folderLinks",
                                    "featuredContent",
                                    "librarySummaryFeed",
                                    "libraryFilter",
                                    "relatedContent",
                                    "sectionSummaries",
                                    "steps",
                                    "libraryNavigation",
                                    "sectionCtas",
                                    "hubspotForm",
                                    "imageSet",
                                    "backgroundImage",
                                    "wistiaEmbed",
                                    "testimonials",
                                    "iconBlurbSet",
                                    "latestNews",
                                    "productRelatedContent",
                                    "dividerV2",
                                    "summaryTilesSimplified",
                                    "feed",
                                    "productUseCases",
                                    "contacts",
                                    "siblingNavigation",
                                    "contentIntro",
                                    "careersEmbed",
                                    "simpleCTA",
                                    "productThemes",
                                    "newsFilter",
                                    "contactForm",
                                    "paymentForm",
                                    "wordArtImage"
                                ],
                                "config":{
    
                                },
                                "styles":{
    
                                },
                                "hasConfig":false,
                                "controls":[
                                    {
                                        "value":[
                                            {
                                                "text":{
                                                    "value":"<p>Testing things</p>",
                                                    "dataTypeGuid":"ca90c950-0aff-4e72-b976-a30b1ac57dad",
                                                    "editorAlias":"text",
                                                    "editorName":"Text"
                                                },
                                                "textSource":{
                                                    "value":"2967",
                                                    "dataTypeGuid":"c9c11005-1852-426d-a6f0-93ede7175b65",
                                                    "editorAlias":"textSource",
                                                    "editorName":"Text Source"
                                                },
                                                "printOverride":{
                                                    "value":"",
                                                    "dataTypeGuid":"c9c11005-1852-426d-a6f0-93ede7175b65",
                                                    "editorAlias":"printOverride",
                                                    "editorName":"Print Override"
                                                }
                                            }
                                        ],
                                        "editor":{
                                            "alias":"rte"
                                        },
                                        "active":true,
                                        "guid":"3fceada4-6b5f-1df8-bec6-d731944b12a4"
                                    }
                                ],
                                "hasActiveChild":true,
                                "active":true
                            }
                        ],
                        "styles":{
    
                        },
                        "config":{
                            "fullWidth":"1"
                        },
                        "hasConfig":true,
                        "id":"a1a9d807-311e-835b-04a3-dc01704184f3",
                        "hasActiveChild":true,
                        "active":true
                    }
                ]
            }
        ]
    }
    

    The only structural difference I see is that one of the properties in the failed test stores it's data as json.

  • Jordan Lane 28 posts 130 karma points c-trib
    Apr 12, 2018 @ 03:26
    Jordan Lane
    0

    Hey Jesse, I've fixed a few issues with LeBlender/uSync recently. I've just created a new PR on Github so they should be released soon. Let me know if that fixes it!

Please Sign in or register to post replies

Write your reply to:

Draft