@@ -635,6 +635,19 @@ void CallSomeAction<T>(T val)
635635 {
636636 this . val = val ;
637637 }
638+
639+ [ Fact ]
640+ public void Can_map_expression_when_mapped_properties_have_a_different_generic_argument_counts ( )
641+ {
642+ //Arrange
643+ Expression < Func < ListParent , bool > > src = x => x . List . Count == 0 ;
644+
645+ //Act
646+ Expression < Func < ListParentExtension , bool > > dest = mapper . Map < Expression < Func < ListParentExtension , bool > > > ( src ) ;
647+
648+ //Assert
649+ Assert . NotNull ( dest ) ;
650+ }
638651 #endregion Tests
639652
640653 private static void SetupAutoMapper ( )
@@ -1018,6 +1031,20 @@ class ItemEntity
10181031 public string Name { get ; set ; }
10191032 }
10201033
1034+ class ListParentExtension
1035+ {
1036+ public ListExtension List { get ; set ; }
1037+ }
1038+
1039+ class ListParent : List < string >
1040+ {
1041+ public List < string > List { get ; set ; }
1042+ }
1043+
1044+ class ListExtension : List < string >
1045+ {
1046+ }
1047+
10211048 public class OrganizationProfile : Profile
10221049 {
10231050 public OrganizationProfile ( )
@@ -1112,6 +1139,13 @@ public OrganizationProfile()
11121139
11131140 CreateMap < OptionT , OptionS > ( ) ;
11141141
1142+ CreateMap < ListParentExtension , ListParent > ( )
1143+ . ReverseMap ( ) ;
1144+ CreateMap < ListExtension , List < string > > ( )
1145+ . ForMember ( d => d . Count , opt => opt . MapFrom ( s => s . Count ) )
1146+ . ReverseMap ( )
1147+ . ForMember ( d => d . Count , opt => opt . MapFrom ( s => s . Count ) ) ;
1148+
11151149 CreateMissingTypeMaps = true ;
11161150 }
11171151 }
0 commit comments