Error editing block property containing nested block property using on-page editing

Vote:
 

Hi,

We have a page (StartPage) which has a block property (FeatureBlock), which in turn contains another block property (ImageBlock). Editing any property inside FeatureBlock using on-page editing on StartPage results in a serialization-error. The payload (propertyName=feature&propertyValue={"imageBlock":{"image":"21681","altText":"Alt tekst"},"title":"Title","ingress":"","buttonText":"","buttonUrl":null}&id=6_25091&renderSettings={"BackgroundClass":"feature-box-block--with-bg"}) seems well formed when posted to /EPiServer/CMS/PropertyRender/Render, but the property value for the ImageBlock ends up as a string which cannot be deserialized. The issue is not present when editing in all properties view. I'm also not sure when this issue first occured.

Could not save property, and it has been reverted. Please try again.

EPiServer.Core.InvalidPropertyValueException: "{
  "image": "21681",
"altText": "Alt text"
}" is not a valid value for "Image".
---> System.InvalidCastException: Unable to cast object of type 'System.String' to type 'xxx.ImageBlock'.
   at EPiServer.SpecializedProperties.PropertyBlock`1.<>c__DisplayClass12_0.<set_Value>b__0()
   at EPiServer.Core.PropertyData.SetPropertyValue(Object value, SetPropertyValueDelegate doSet)
   --- End of inner exception stack trace ---
   at EPiServer.Core.PropertyData.ThrowEditorFriendlyException(Object value, Exception e)
   at EPiServer.Core.PropertyData.SetPropertyValue(Object value, SetPropertyValueDelegate doSet)
   at EPiServer.SpecializedProperties.PropertyBlock`1.set_Value(Object value)
   at EPiServer.Cms.Shell.Json.Internal.BlockDataConverter.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.JsonSerializer.Deserialize(TextReader reader, Type objectType)
   at EPiServer.Framework.Serialization.Json.Internal.JsonObjectSerializer.Deserialize(TextReader reader, Type objectType)
   at EPiServer.Shell.Serialization.Json.Internal.CompositeJsonObjectSerializer.Deserialize(TextReader reader, Type type)
   at EPiServer.Cms.Shell.UI.Controllers.Internal.PropertyRenderController.DeserializeValue(String value, Type propertyType)
   at EPiServer.Cms.Shell.UI.Controllers.Internal.PropertyRenderController.Render(String propertyName, String propertyValue, String id, String renderSettings, String epslanguage)
   at lambda_method1085(Closure, Object, Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
 at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()

I realize the issue could likely be worked around by using ContentReference properties instead of using the actual block itself, but this is a big project with many editors already used to the existing workflow, and many existing properties would lose existing data with such a change.

#315124
Jan 05, 2024 8:14
Vote:
 

The issue has been resolved with EPiServer.CMS.UI 12.27.0.

#315860
Jan 19, 2024 12:07
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.