Copied to clipboard

Flag this post as spam?

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


  • Karl Kopp 121 posts 227 karma points
    Sep 05, 2016 @ 09:13
    Karl Kopp
    0

    Issue with GetCropUrl after 7.2 -> 7.5 upgrade

    Hi all - post an upgrade from 7.2 -> 7.5 I'm starting to see some errors in GetCropUrl (stacktrace below). I have the following code:

    var venue = Umbraco.TypedContent(venueId);
    ...
    @if (venue.HasProperty("image1") && venue.HasValue("image1")) {
    <div><a href="@venue.Url"><img src="@Url.GetCropUrl(venue, "image1", "square100")" class="round-image-small" alt="@venue.Name"></a></div>
    }
    

    while it used to work, it now throws the below error. I've also used the old method venue.GetCropUrl("image1", "square100") with the same result.

    Error loading Partial View (file: ~/Views/MacroPartials/Nearby.cshtml). Exception: Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Decimal'. Path 'focalPoint.left'. ---> System.InvalidCastException: Null object cannot be converted to a value type.
       at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
       --- End of inner exception stack trace ---
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateDynamic(JsonReader reader, JsonDynamicContract contract, JsonProperty member, String id)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
       at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
       at Umbraco.Core.Serialization.NoTypeConverterJsonConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
       at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
       at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
       at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
       at Newtonsoft.Json.Linq.JToken.ToObject[T](JsonSerializer jsonSerializer)
       at Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedProperty.get_Value()
       at Umbraco.Web.ImageCropperTemplateExtensions.GetCropUrl(IPublishedContent mediaItem, Nullable`1 width, Nullable`1 height, String propertyAlias, String cropAlias, Nullable`1 quality, Nullable`1 imageCropMode, Nullable`1 imageCropAnchor, Boolean preferFocalPoint, Boolean useCropDimensions, Boolean cacheBuster, String furtherOptions, Nullable`1 ratioMode, Boolean upScale)
       at Umbraco.Web.ImageCropperTemplateExtensions.GetCropUrl(IPublishedContent mediaItem, String propertyAlias, String cropAlias)
       at ASP._Page_Views_MacroPartials_NearbySpecials_cshtml.Execute() in d:\home\site\wwwroot\Views\MacroPartials\Nearby.cshtml:line 202
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
       at Umbraco.Web.Mvc.ControllerExtensions.RenderViewResultAsString(ControllerBase controller, ViewResultBase viewResult)
       at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, IPublishedContent content)
       at umbraco.macro.LoadPartialViewMacro(MacroModel macro)
       at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
    
  • Karl Kopp 121 posts 227 karma points
    Sep 06, 2016 @ 00:40
    Karl Kopp
    0

    For anyone else, I'm now tracking this along in this bug:

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

Please Sign in or register to post replies

Write your reply to:

Draft