Open Closed

AutoMapper Error on V 5.3.2 #3419


User avatar
0
otee@urvin.finance created

After upgrading all my packages i get this in my application: Our solution is a microservice and this occurs in all services


8 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Did you add the Automapper package to your project manual?

    Please search Automapper in all .csproj files.

  • User Avatar
    0
    otee@urvin.finance created

    I didn't. I've searched and didn't find any. It's all :Volo.Abp.AutoMapper 5.3.2

  • User Avatar
    0
    scott7106 created

    We are using the standard application template with Angular UI and all application services (and their associated tests) fail with what I think is the same issue.

    I upgraded all Nuget package references to v5.3.2 and all NPM package references for Angular to 5.3.2 from 5.2.1. After the upgrade, all application unit tests fail with the message below.

    EDIT: I can comment out all of mapping defined in my project and I still get this error.

    Message: 
    Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module OtisEd.Zipline.ZiplineTestBaseModule, OtisEd.Zipline.TestBase, Version=0.1.1.0, Culture=neutral, PublicKeyToken=null: An exception was thrown while activating Volo.Abp.ObjectMapping.DefaultObjectMapper`1[[Volo.Abp.Identity.AbpIdentityDomainModule, Volo.Abp.Identity.Domain, Version=5.3.2.0, Culture=neutral, PublicKeyToken=null]] -> Volo.Abp.AutoMapper.AutoMapperAutoObjectMappingProvider`1[[Volo.Abp.Identity.AbpIdentityDomainModule, Volo.Abp.Identity.Domain, Version=5.3.2.0, Culture=neutral, PublicKeyToken=null]] -> λ:Volo.Abp.AutoMapper.IMapperAccessor -> λ:Volo.Abp.AutoMapper.MapperAccessor.. See the inner exception for details.
    ---- Autofac.Core.DependencyResolutionException : An exception was thrown while activating Volo.Abp.ObjectMapping.DefaultObjectMapper`1[[Volo.Abp.Identity.AbpIdentityDomainModule, Volo.Abp.Identity.Domain, Version=5.3.2.0, Culture=neutral, PublicKeyToken=null]] -> Volo.Abp.AutoMapper.AutoMapperAutoObjectMappingProvider`1[[Volo.Abp.Identity.AbpIdentityDomainModule, Volo.Abp.Identity.Domain, Version=5.3.2.0, Culture=neutral, PublicKeyToken=null]] -> λ:Volo.Abp.AutoMapper.IMapperAccessor -> λ:Volo.Abp.AutoMapper.MapperAccessor.
    -------- System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
    ------------ System.MissingMethodException : Method not found: 'Void AutoMapper.IMemberConfigurationExpression`3.MapFrom(System.Linq.Expressions.Expression`1<System.Func`2<!0,!!0>>)'.
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi otee@urvin.finance and scott7106

    Can you share a project to reproduce the issue? liming.ma@volosoft.com

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Void AutoMapper.IMemberConfigurationExpression3.MapFrom(System.Linq.Expressions.Expression1<System.Func2&lt;!0,!!0&gt;>)'. at OtisEd.Alerts.AlertsApplicationAutoMapperProfile.<>c.<.ctor>b__0_3(IMemberConfigurationExpression3 opt)

    Can you share a sample project? You can use the template project.

  • User Avatar
    0
    scott7106 created

    Interesting. This is an embedded module we use for generating user alerts. This is a different error from what I am seeing which points to the Volo.Abp.Identity.AbpIdentityDomainModule. Did you change something to get the different error? Or is that the initial error you received?

    Let me upgrade the module to 5.3.2 and subsequently AutoMapper 11 and see what happens. For what it is worth, here is the AutoMapper code from that module.

    using AutoMapper;
    using Volo.Abp.AutoMapper;
    using OtisEd.Alerts.Messages;
    
    namespace OtisEd.Alerts;
    
    public class AlertsApplicationAutoMapperProfile : Profile
    {
        public AlertsApplicationAutoMapperProfile()
        {
            /* You can configure your AutoMapper mapping configuration here.
             * Alternatively, you can split your mapping configurations
             * into multiple profile classes for a better organization. */
            CreateMap< MessageCreateDto, AlertMessage >()
                .IgnoreAuditedObjectProperties()
                .Ignore(x => x.Id)
                .Ignore(x => x.TenantId)
                .ForMember(dest => dest.IsRead, opt => opt.MapFrom(x => false));
            CreateMap< AlertMessage, MessageDto >();
        }
    }
    
  • User Avatar
    0
    scott7106 created

    Upgrading the alerts module resolved the issue for me. Thanks for your help.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Good news.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09