Hi,
We are using AutoMapper in our Commerce site. While mapping from the custom model to an EPiServer Model(VariationContent) throws a below error.
Adding to that vice versa works properly. Also In version 10.2.1 works well, but not in 12.4.
I have mentioned the codes below with an error.
cfg.CreateMap()
.ForMember(dest => dest.Orientation, opt => opt.Ignore())
.ForMember(dest => dest.Series, opt => opt.Ignore())
.ForMember(dest => dest.Tested, opt => opt.Ignore())
.ForMember(dest => dest.Rotation, opt => opt.Ignore())
.ForMember(dest => dest.Material, opt => opt.Ignore())
.IgnoreAllNonExistingProperties();
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
EPiServer.Commerce.Catalog.DataAnnotations.ValidUrlAttribute..ctor(LocalizationService localizationService, UrlSegmentOptions urlSegmentOptions) +67
EPiServer.Commerce.Catalog.DataAnnotations.ValidUrlAttribute..ctor() +76
System.RuntimeTypeHandle.CreateCaInstance(RuntimeType type, IRuntimeMethodInfo ctor) +0
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +1471
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType) +106
System.Reflection.RuntimePropertyInfo.GetCustomAttributes(Boolean inherit) +37
AutoMapper.Configuration.MappingExpression`2.Configure(TypeMap typeMap) +122
AutoMapper.ProfileMap.BuildTypeMap(IConfigurationProvider configurationProvider, ITypeMapConfiguration config) +65
AutoMapper.ProfileMap.Register(IConfigurationProvider configurationProvider) +75
AutoMapper.MapperConfiguration.Seal() +151
AutoMapper.MapperConfiguration..ctor(MapperConfigurationExpression configurationExpression) +764
AutoMapper.MapperConfiguration..ctor(Action`1 configure) +23
SnS.Infrastructure.DependencyResolverInitialization.GetMappingConfiguration() in D:\Phase13-upgrading\src\SnS\Infrastructure\DependencyResolverInitialization.cs:195
SnS.Infrastructure.DependencyResolverInitialization.ConfigureContainer(ConfigurationExpression container) in D:\Phase13-upgrading\src\SnS\Infrastructure\DependencyResolverInitialization.cs:190
StructureMap.PipelineGraph.Configure(Action`1 configure) +97
StructureMap.Container.Configure(Action`1 configure) +93
SnS.Infrastructure.DependencyResolverInitialization.ConfigureContainer(ServiceConfigurationContext context) in D:\Phase13-upgrading\src\SnS\Infrastructure\DependencyResolverInitialization.cs:70
EPiServer.Framework.Initialization.Internal.<>c__DisplayClass4_0.b__0() +16
EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key) +52
EPiServer.Framework.Initialization.Internal.ModuleNode.ConfigureContainer(ServiceConfigurationContext context) +100
EPiServer.Framework.Initialization.InitializationEngine.ConfigureCurrentModules(Boolean final) +177
EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +115
EPiServer.Framework.Initialization.InitializationEngine.Initialize() +40
EPiServer.Framework.Initialization.<>c.b__7_0(InitializationEngine e) +9
EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +338
EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +170
EPiServer.Global..ctor() +43
SnS.EPiServerApplication..ctor() +42
ASP.global_asax..ctor() in c:\Users\User\AppData\Local\Temp\Temporary ASP.NET Files\root\d16a9737\21107c38\App_global.asax.0.cs:0
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +119
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1117
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +124
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +20
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +59
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +287
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +303
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +772
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +195 > >
Please help me out,
Advance thanks,
regards,
Karthik