Base solution for your next web application
Open Closed

Mapper not initialized #7471


User avatar
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.<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 redo.Procedures.ProcedureAppService.<CreateOrUpdateProcedure>d__37.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...`

I'm missing somethings?

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    andmattia created

    No unfortunatly no.

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

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    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); 
    
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    andmattia created

    I found another issue releted to this topic AutoMapper and CustomDto

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    maliming created
    Support Team

    Please follow Github's issue

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)