U4-11023 - Creating a documenttype without any properties throws an Automapper Exception

Created by Mark Wemekamp 27 Feb 2018, 19:50:12 Updated by Dave Clarke 08 Mar 2018, 10:22:09

Duplicates: U4-11018

I just installed Umbraco 7.9.0 on my local machine. Created a documenttype with just a name, no properties and allowed it to be a root level node. When I wanted to created a node in the content section I got the error below. As soon as I added a property to the documenttype everything worked fine

ERROR Umbraco.Web.Editors.ContentController - Unhandled controller exception occurred
AutoMapper.AutoMapperMappingException: 

Mapping types:
Content -> IEnumerable`1
Umbraco.Core.Models.Content -> System.Collections.Generic.IEnumerable`1[[Umbraco.Web.Models.ContentEditing.Tab`1[[Umbraco.Web.Models.ContentEditing.ContentPropertyDisplay, umbraco, Version=1.0.6631.28270, Culture=neutral, PublicKeyToken=null]], umbraco, Version=1.0.6631.28270, Culture=neutral, PublicKeyToken=null]]

Destination path:
ContentItemDisplay.Tabs.Tabs

Source value:
Umbraco.Core.Models.Content ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at Umbraco.Web.Models.Mapping.TabsAndPropertiesResolver`1.ResolveCore(UmbracoContext umbracoContext, TSource content)
   at Umbraco.Web.Models.Mapping.TabsAndPropertiesResolver`1.Resolve(ResolutionResult source)
   at AutoMapper.PropertyMap.<ResolveValue>b__6(ResolutionResult current, IValueResolver resolver) in c:\dev\AutoMapper\src\AutoMapper\PropertyMap.cs:line 127
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at AutoMapper.PropertyMap.ResolveValue(ResolutionContext context) in c:\dev\AutoMapper\src\AutoMapper\PropertyMap.cs:line 127
   at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.MapPropertyValue(ResolutionContext context, IMappingEngineRunner mapper, Object mappedObject, PropertyMap propertyMap) in c:\dev\AutoMapper\src\AutoMapper\Mappers\TypeMapObjectMapperRegistry.cs:line 116
   --- End of inner exception stack trace ---
   at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.MapPropertyValue(ResolutionContext context, IMappingEngineRunner mapper, Object mappedObject, PropertyMap propertyMap) in c:\dev\AutoMapper\src\AutoMapper\Mappers\TypeMapObjectMapperRegistry.cs:line 153
   at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.Map(ResolutionContext context, IMappingEngineRunner mapper) in c:\dev\AutoMapper\src\AutoMapper\Mappers\TypeMapObjectMapperRegistry.cs:line 89
   at AutoMapper.Mappers.TypeMapMapper.Map(ResolutionContext context, IMappingEngineRunner mapper) in c:\dev\AutoMapper\src\AutoMapper\Mappers\TypeMapMapper.cs:line 22
   at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) in c:\dev\AutoMapper\src\AutoMapper\MappingEngine.cs:line 250
   at AutoMapper.MappingEngine.MapCore(Object source, Type sourceType, Type destinationType, MappingOperationOptions options) in c:\dev\AutoMapper\src\AutoMapper\MappingEngine.cs:line 131
   at AutoMapper.MappingEngine.Map[TSource,TDestination](TSource source, Action`1 opts) in c:\dev\AutoMapper\src\AutoMapper\MappingEngine.cs:line 90
   at AutoMapper.Mapper.Map[TSource,TDestination](TSource source, Action`1 opts) in c:\dev\AutoMapper\src\AutoMapper\Mapper.cs:line 113
   at Umbraco.Web.Models.Mapping.AutoMapperExtensions.MapWithUmbracoContext[TIn,TOut](TIn obj, UmbracoContext umbCtx)
   at Umbraco.Web.Editors.ContentController.GetById(Int32 id)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)

Comments

Dave Clarke 08 Mar 2018, 09:39:10

I can reproduce this on 7.9.0, was working prior to upgrade on 7.8.x.


Sebastiaan Janssen 08 Mar 2018, 10:09:25

@clarkd yes, the bug was introduced in 7.9.0, if you look at the issue this one duplicates (U4-11018) you'll see that it was fixed immediately. Make sure to upgrade to 7.9.2.


Dave Clarke 08 Mar 2018, 10:22:09

@sebastiaan Ah, thanks - not too familiar with YouTrack so didn't spot the duplicate!


Priority: Normal

Type: Bug

State: Duplicate

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.9.0

Due in version:

Sprint:

Story Points:

Cycle: