@@ -210,7 +210,8 @@ static Expression CheckNullValueType(Expression expression, Type runtimeType) =>
210210 LambdaExpression GenerateObjectMapperExpression ( in MapRequest mapRequest , IObjectMapper mapper )
211211 {
212212 var source = Parameter ( mapRequest . RequestedTypes . SourceType , "source" ) ;
213- var destination = Parameter ( mapRequest . RequestedTypes . DestinationType , "mapperDestination" ) ;
213+ var destinationType = mapRequest . RequestedTypes . DestinationType ;
214+ var destination = Parameter ( destinationType , "mapperDestination" ) ;
214215 var runtimeDestinationType = mapRequest . RuntimeTypes . DestinationType ;
215216 Expression fullExpression ;
216217 bool nullCheck ;
@@ -230,8 +231,7 @@ LambdaExpression GenerateObjectMapperExpression(in MapRequest mapRequest, IObjec
230231 var map = mapper . MapExpression ( this , Configuration , mapRequest . MemberMap , mapperSource , ToType ( checkNullValueTypeDest , runtimeDestinationType ) ) ;
231232 nullCheck = map != mapperSource ;
232233 var newException = Call ( MappingError , ExceptionParameter , Constant ( mapRequest ) ) ;
233- var throwExpression = Throw ( newException , destination . Type ) ;
234- fullExpression = TryCatch ( ToType ( map , destination . Type ) , Catch ( ExceptionParameter , throwExpression ) ) ;
234+ fullExpression = TryCatch ( ToType ( map , destinationType ) , Catch ( ExceptionParameter , Throw ( newException , destinationType ) ) ) ;
235235 }
236236 if ( nullCheck )
237237 {
0 commit comments