Open Closed

Mapper not initialized #7471


0
andmattia created

Hi,

after the update of my solution to v7.1.0 for ASP.NET MVC 5.x & Angularjs 1.x .NET Framework 4.6.1 I've this expection in Mapper.Map(,)

System.InvalidOperationException: Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource extension methods, make sure you pass in the appropriate IConfigurationProvider instance. at AutoMapper.Mapper.get_Instance() at AutoMapper.Mapper.Map[TSource,TDestination](TSource source, TDestination destination) at redo.Procedures.ProcedureAppService.<UpdateProcedureAsync>d__45.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.

I'm missing somethings?


5 Answer(s)
  • 0
    ismcagdas created
  • 0
    andmattia created

    No unfortunatly no.

    At the moment all Call made via AutoMapper.Map(input,Output) give the same error

  • 0
    andmattia created

    We found a solution but I'm not sure is the correct way. Add this line off code at the end of first CustomDtoMapper. We add only at the first becasue if you use it on more module Automapper give an exception that say "Mapper already initialize"

       // Add for AutoMap 8.x
        Mapper.Initialize((MapperConfigurationExpression) mapper); 
    
  • 0
    andmattia created

    I found another issue releted to this topic AutoMapper and CustomDto

  • 0
    maliming created

    Please follow Github's issue