Mapping types:
Media -> UserProfile
Umbraco.Core.Models.Media -> Umbraco.Web.Models.ContentEditing.UserProfile
Destination path:
ContentItemBasic`2.Owner.Owner
Source value:
Umbraco.Core.Models.Media ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Umbraco.Core.Services.UserService.GetProfileById(Int32 id)
at Umbraco.Web.Models.Mapping.OwnerResolver1.ResolveCore(TPersisted source)
at AutoMapper.ValueResolver2.Resolve(ResolutionResult source) in c:\dev\AutoMapper\src\AutoMapper\ValueResolver.cs:line 12
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable1 source, TAccumulate seed, Func3 func)
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.Map[TSource,TDestination](TSource source) in c:\dev\AutoMapper\src\AutoMapper\MappingEngine.cs:line 78
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Umbraco.Web.WebApi.Filters.FilterAllowedOutgoingMediaAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
at System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)
I had some columns in both cmsDocument and umbracoNode tables where the user didn't exist in the user table. How that can have happened I don't know. Doing an update on those columns and setting a userid that exists seems to have worked...
Thanks! this fixed my issue also. We'd removed users from db.. accidentally causing this issue.
Fixed with following query..
update cmsDocument
set documentUser = {a valid user}
where documentUser not in (select id from umbracoUser)
update umbracoNode
set nodeUser = {a valid user}
where nodeUser not in (select id from umbracoUser)
Strange exception in media browser
One of our production sites has all of the sudden started to throw an exception when browsing certain media folders.
As you can see it's possible to open the folder "Bo" in the tree. But when a user clicks on it they get this error message.
http://prntscr.com/lcm0sw
It's also possible to click on every image/folder beneath "Bo" in the tree without any error.
Below is the exception in the log. Seems to have something to do with a missing user?
2018-10-31 10:46:43,952 [P11208/D2/T115] ERROR Umbraco.Web.Editors.MediaController - Unhandled controller exception occurred AutoMapper.AutoMapperMappingException:
Mapping types: Media -> UserProfile Umbraco.Core.Models.Media -> Umbraco.Web.Models.ContentEditing.UserProfile
Destination path: ContentItemBasic`2.Owner.Owner
Source value: Umbraco.Core.Models.Media ---> System.NullReferenceException: Object reference not set to an instance of an object. at Umbraco.Core.Services.UserService.GetProfileById(Int32 id) at Umbraco.Web.Models.Mapping.OwnerResolver
1.ResolveCore(TPersisted source) at AutoMapper.ValueResolver
2.Resolve(ResolutionResult source) in c:\dev\AutoMapper\src\AutoMapper\ValueResolver.cs:line 12 at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable1 source, TAccumulate seed, Func
3 func) 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.Map[TSource,TDestination](TSource source) in c:\dev\AutoMapper\src\AutoMapper\MappingEngine.cs:line 78 at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source) at Umbraco.Web.WebApi.Filters.FilterAllowedOutgoingMediaAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext) at System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)I had some columns in both cmsDocument and umbracoNode tables where the user didn't exist in the user table. How that can have happened I don't know. Doing an update on those columns and setting a userid that exists seems to have worked...
Thanks! this fixed my issue also. We'd removed users from db.. accidentally causing this issue.
Fixed with following query..
Thanks, David !!!
This has just saved me hours of investigating. Thanks for the script David!
is working on a reply...