I'm getting an Exception Message: Sequence contains more than one matching element.
Here is my StackTrace:
{"Message":"An error has occurred.","ExceptionMessage":"Sequence contains more than one matching element","ExceptionType":"System.InvalidOperationException","StackTrace":" at System.Linq.Enumerable.Single[TSource](IEnumerable1 source, Func2 predicate)\r\n at Umbraco.Web.Models.Mapping.TabsAndPropertiesResolver.ResolveCore(IContentBase content)\r\n at AutoMapper.ValueResolver2.Resolve(ResolutionResult source)\r\n at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable1 source, TAccumulate seed, Func`3 func)\r\n at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.MapPropertyValue(ResolutionContext context, IMappingEngineRunner mapper, Object mappedObject, PropertyMap propertyMap)"}
Sequence contains more than one matching element
Hi all,
I'm getting an Exception Message: Sequence contains more than one matching element.
Here is my StackTrace:
{"Message":"An error has occurred.","ExceptionMessage":"Sequence contains more than one matching element","ExceptionType":"System.InvalidOperationException","StackTrace":" at System.Linq.Enumerable.Single[TSource](IEnumerable
1 source, Func
2 predicate)\r\n at Umbraco.Web.Models.Mapping.TabsAndPropertiesResolver.ResolveCore(IContentBase content)\r\n at AutoMapper.ValueResolver2.Resolve(ResolutionResult source)\r\n at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable
1 source, TAccumulate seed, Func`3 func)\r\n at AutoMapper.Mappers.TypeMapObjectMapperRegistry.PropertyMapMappingStrategy.MapPropertyValue(ResolutionContext context, IMappingEngineRunner mapper, Object mappedObject, PropertyMap propertyMap)"}Thanks to all who can help in advance!
Hi Earnest,
It's because Single method should return only one item and in your case there are few.
Can you use First() or Last() instad of Single()?
Also please share code with us we will help you.
Thanks,
Alex
is working on a reply...