We have moved to GitHub Issues
Created by Robert Foster 04 Nov 2014, 19:55:33 Updated by Robert Foster 03 Jul 2015, 01:58:37
Relates to: U4-5769
Relates to: U4-5712
Adding more than one Mixin Document Type with a tab of the same name to a new Document Type's Composition, or adding a Mixin to a Document Type that already contains a tab with the same name results in an Exception thrown when trying to edit or create a new content node.
In addition, the duplicate tabs are displayed in the Document Type Generic Properties pane.
** Scenario 1: ** (Actually I confused myself with this one - I actually had Scenario 2 below twice. Leaving this here anyway as it could very well still be a problem) Existing Document Type has a tab named "Settings". Add a Mixin Document Type that also has a tab named "Settings" results in two "Settings" tabs and the following exception when trying to edit a content node based on it: Received an error from the server
Failed to retrieve data for content id 1092
Sequence contains more than one matching element
Exception Details: System.InvalidOperationException: Sequence contains more than one matching element
1 source, Func2 predicate)
at Umbraco.Web.Models.Mapping.TabsAndPropertiesResolver.ResolveCore(IContentBase content)
2.Resolve(ResolutionResult source) at AutoMapper.DeferredInstantiatedResolver.Resolve(ResolutionResult source) at AutoMapper.PropertyMap.<ResolveValue>b__6(ResolutionResult current, IValueResolver resolver) at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable1 source, TAccumulate seed, Func`3 func)
at AutoMapper.PropertyMap.ResolveValue(ResolutionContext context)
at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.MapPropertyValue(ResolutionContext context, IMappingEngineRunner mapper, Object mappedObject, PropertyMap propertyMap)
** Scenario 2: ** Add two mixins to a Document Type that both contain the tab "Settings" and a similar result is given. Both "Settings" tabs are displayed in the Generic Properties pane and the exception raised when trying to edit or create a node is the same.
The cause of the problem is the code currently expects tabs to each have a unique name, but with inheritance it's possible to have two tabs with the same name.
This is the same issue as U4-4253 Renaming tabs can cause issues when tab with same name exists on derived document type. 7.x
To fix this, change line # 213 of Umbraco-CMS\src\Umbraco.Web\Models\Mapping\TabsAndPropertiesResolver.cs from
var rootGroup = propertyGroups.Single(x => x.ParentId == null); to var rootGroup = propertyGroups.First(x => x.ParentId == null);
This issue was first reported back in 7.0.4
Difficulty: Very Easy
Backwards Compatible: True
Fix Submitted: Inline code
Affected versions: 7.2.0
Due in version: