Copied to clipboard

Flag this post as spam?

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


  • Thobias 14 posts 104 karma points
    Jul 21, 2017 @ 11:56
    Thobias
    0

    Preview throws error at GetPropertyValue on media pickers when property data is a guid

    HI,

    i got some trouble with my preview. Maybe you can help me. First, the stacktrace:

    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) 
    at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) 
    at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() 
    at System.Linq.Buffer`1..ctor(IEnumerable`1 source) 
    at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) 
    at Umbraco.Web.PropertyEditors.ValueConverters.MultipleMediaPickerPropertyConverter.ConvertDataToSource(PublishedPropertyType propertyType, Object source, Boolean preview) 
    at Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedProperty.get_Value() 
    at Umbraco.Web.PublishedPropertyExtension.GetValue[T](IPublishedProperty property, Boolean withDefaultValue, T defaultValue) at Umbraco.Web.PublishedContentModels.xxxxx.get_Image() 
    at ASP._Page_Views_Partials_Grid_Editors_xxxxxxxx_cshtml.Execute()
    

    This happens when i want to get the PropertyValue from a media picker field. On published view the image is rendered and no exception.

    The RawData is a Guid at preview and on published view a id.

    Any ideas why this happens?

    Best Thobias

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jul 21, 2017 @ 13:25
    Alex Skrypnyk
    0

    Hi Thobias

    Can you show the code?

    Thanks,

    Alex

  • Thobias 14 posts 104 karma points
    Jul 21, 2017 @ 13:29
    Thobias
    0

    I am not really sure what kind of code you want to see, maybe this:

     <a href="@publication.ImageLink.Url" target="_blank">test </a>
    

    and the generated method from "publication" type:

    ///<summary>
            /// Image Link
            ///</summary>
            [ImplementPropertyType("imageLink")]
            public IPublishedContent ImageLink
            {
                get { return this.GetPropertyValue<IPublishedContent>("imageLink"); }
            }
    

    Does this help you?

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jul 21, 2017 @ 13:41
    Alex Skrypnyk
    0

    Can you debug this code?

    Only preview mode causes the exception?

  • Thobias 14 posts 104 karma points
    Jul 21, 2017 @ 13:42
    Thobias
    0

    Dont know at which point i should debug. Which class put the Guid instead of Id in the raw data?

Please Sign in or register to post replies

Write your reply to:

Draft