Skip to content

True/false value nested in block list not passed correctly when restoring content #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jaandrews opened this issue Feb 11, 2025 · 0 comments

Comments

@jaandrews
Copy link

jaandrews commented Feb 11, 2025

A brief description of the issue goes here.

When I restore content that contains a block list with a block that has an "Umbraco.TrueFalse" property, I get the following error message when visit the restored node.

Cannot assign value "False" of type "System.String" to property "{property alias}" expecting type "System.Int32".

Note this is only an issue for true/false properties inside a block list (and possibly a block grid). True/false properties directly on content nodes transfer as expected. Likely cause is that the block list isn't converting the block data inside it before transferring the data. Error happens in this case because the property isn't set to 0 or 1.

Reproduction

  1. Create a doc type that is an element type with an "Umbraco.TrueFalse" property.
  2. Add that doc type as a block to a new block list data type.
  3. Add the block list to another doc type.
  4. Deploy these changes to another environment (in my case I deployed to Umbraco Cloud).
  5. Create a content node in the environment created in step 5 with the doc type created in step 3. Make sure to create a couple items in the block list.
  6. Save and publish that node.
  7. Go back to the first environment and do a partial restore targeting the newly created node in the other environment.
  8. Visit the newly created node and you should see the error.

Specifics

Umbraco: 13.6.0
Umbraco Deploy: 13.4.0

Here is the full stack trace of the error.

System.InvalidOperationException, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: Cannot assign value "False" of type "System.String" to property "conditionsUseAndLogic" expecting type "System.Int32".
at Umbraco.Cms.Core.Models.Property.ThrowTypeException(Object value, Type expected, String alias)
at Umbraco.Cms.Core.Models.Property.TryConvertAssignedValue(Object value, Boolean throwOnError, Object& converted)
at Umbraco.Cms.Core.PropertyEditors.BlockValuePropertyValueEditorBase.MapBlockItemDataToEditor(IProperty property, List1 items) at Umbraco.Cms.Core.PropertyEditors.BlockEditorPropertyValueEditor.ToEditor(IProperty property, String culture, String segment) at Umbraco.Cms.Core.Models.Mapping.ContentPropertyBasicMapper1.Map(IProperty property, TDestination dest, MapperContext context)
at Umbraco.Cms.Core.Models.Mapping.ContentPropertyDisplayMapper.Map(IProperty originalProp, ContentPropertyDisplay dest, MapperContext context)
at Umbraco.Cms.Core.Mapping.UmbracoMapper.Map[TTarget](Object source, Type sourceType, MapperContext context)
at Umbraco.Cms.Core.Mapping.UmbracoMapper.Map[TSource,TTarget](TSource source, MapperContext context)
at System.Linq.Enumerable.SelectIPartitionIterator2.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.ToList()
at Umbraco.Cms.Core.Models.Mapping.TabsAndPropertiesMapper1.Map(TSource source, MapperContext context) at Umbraco.Cms.Web.BackOffice.Mapping.ContentMapDefinition.Map(IContent source, ContentVariantDisplay target, MapperContext context) at Umbraco.Cms.Web.BackOffice.Mapping.ContentMapDefinition.Map(IContent source, ContentVariantScheduleDisplay target, MapperContext context) at Umbraco.Cms.Core.Mapping.UmbracoMapper.Map[TTarget](Object source, Type sourceType, MapperContext context) at Umbraco.Cms.Core.Mapping.UmbracoMapper.Map[TTarget](Object source, MapperContext context) at Umbraco.Cms.Core.Models.Mapping.ContentVariantMapper.Map[TVariant](IContent source, MapperContext context) at Umbraco.Cms.Web.BackOffice.Mapping.ContentMapDefinition.Map[TVariant](IContent source, ContentItemDisplay1 target, MapperContext context)
at Umbraco.Cms.Core.Mapping.UmbracoMapper.Map[TTarget](Object source, Type sourceType, MapperContext context)
at Umbraco.Cms.Core.Mapping.UmbracoMapper.Map[TTarget](Object source, MapperContext context)
at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.MapToDisplayWithSchedule(IContent content)
at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.GetById(Int32 id)
at lambda_method354(Closure, Object, Object[])
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
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()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant