Copied to clipboard

Flag this post as spam?

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


  • Wojciech Tengler 95 posts 198 karma points
    Sep 07, 2020 @ 15:20
    Wojciech Tengler
    0

    (Obsolete) Media Picker and property value converters

    Hi!

    I'm just upgrading Umbraco 6 to 7 and found problem with property value converters.

    I want to use obsolete Media Picker which stores value as integer and have enabled property value converters but when I'm trying to load node for editing I see error like this:

    Umbraco Media picker Mapping types: Content -> String[] Umbraco.Core.Models.Content -> System.String[] Destination path: ContentItemDisplay.Urls.Urls Source value: Umbraco.Core.Models.Content
    

    More detailed error from Umbraco Log:

    2020-09-07 16:08:51,867 [P1844/D3/T44] ERROR Umbraco.Web.Editors.ContentController - Unhandled controller exception occurred
    AutoMapper.AutoMapperMappingException: 
    
    Mapping types:
    Content -> String[]
    Umbraco.Core.Models.Content -> System.String[]
    
    Destination path:
    ContentItemDisplay.Urls.Urls
    
    Source value:
    Umbraco.Core.Models.Content ---> System.InvalidOperationException: The current pre-value collection is array based, use the PreValuesAsArray property instead. This usually indicates that the content cache is corrupt; the content cache has been rebuilt in an attempt to self-fix the issue.
       at Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedContent.InitializeNode(XmlNode xmlNode, Boolean legacy, Boolean isPreviewing, Int32& id, Guid& key, Int32& template, Int32& sortOrder, String& name, String& writerName, String& urlName, String& creatorName, Int32& creatorId, Int32& writerId, String& docTypeAlias, Int32& docTypeId, String& path, Guid& version, DateTime& createDate, DateTime& updateDate, Int32& level, Boolean& isDraft, PublishedContentType& contentType, Dictionary`2& properties, Func`3 getPublishedContentType)
       at Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedContent.InitializeNode()
       at Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedContent.EnsureNodeInitialized(Boolean andChildren, Boolean andParent)
       at Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedContent.get_Path()
       at Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedContentCache.AddToCacheIfDeepestRoute(UmbracoContext umbracoContext, IPublishedContent content, String route)
       at Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedContentCache.GetByRoute(UmbracoContext umbracoContext, Boolean preview, String route, Nullable`1 hideTopLevelNode)
       at Umbraco.Web.Routing.ContentFinderByNiceUrl.FindContent(PublishedContentRequest docreq, String route)
       at Umbraco.Web.Routing.ContentFinderByNiceUrl.TryFindContent(PublishedContentRequest docRequest)
       at Umbraco.Web.Routing.PublishedContentRequestEngine.<FindPublishedContent>b__17_0(IContentFinder finder)
       at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
       at Umbraco.Web.Routing.PublishedContentRequestEngine.FindPublishedContent()
       at Umbraco.Web.Routing.PublishedContentRequestEngine.TryRouteRequest()
       at Umbraco.Web.Routing.UrlProviderExtensions.GetContentUrls(IContent content, UmbracoContext umbracoContext)
       at Umbraco.Web.Models.Mapping.ContentModelMapper.ContentUrlResolver.Resolve(ResolutionResult source)
       at AutoMapper.DeferredInstantiatedResolver.Resolve(ResolutionResult source)
       at AutoMapper.PropertyMap.<ResolveValue>b__6(ResolutionResult current, IValueResolver resolver)
       at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
       at AutoMapper.PropertyMap.ResolveValue(ResolutionContext context)
       at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.MapPropertyValue(ResolutionContext context, IMappingEngineRunner mapper, Object mappedObject, PropertyMap propertyMap)
       --- End of inner exception stack trace ---
    

    When I disable property value converters then I can edit the same node and see picked image correctly.

    So there is not available property converter for obsolete Media Picker in the core or there is any other problem I can fix?

    Yes, I know that I can convert selected medias to UDI format but I have a lot of XSLT files which need media id for umbraco.library.GetMedia() extension. I'm trying to optimize jobs related to this Upgrade.

  • Wojciech Tengler 95 posts 198 karma points
    Sep 08, 2020 @ 07:16
    Wojciech Tengler
    100

    I have just fixed it by saving Media Picker data type. Strange but I don't see any changes in db.

Please Sign in or register to post replies

Write your reply to:

Draft