The following sample unit test passes in v10.0.6, but fails in 10.0.7 where result1 is 0.
publicclassMapsterSample{[Fact]publicvoidMapsterSampleTest(){varconfig=TypeAdapterConfig.GlobalSettings.Fork(config =>{config.ForType<SourceClass,DestinationClass>().Map(dest =>dest.Value, src =>src.UseSecondaryValue?src.SecondaryValue1+src.SecondaryValue2:src.PrimaryValue);});varsource1=newSourceClass{UseSecondaryValue=false,PrimaryValue=100};varsource2=newSourceClass{UseSecondaryValue=true,SecondaryValue1=10,SecondaryValue2=20};varresult1=source1.Adapt<DestinationClass>(config);varresult2=source2.Adapt<DestinationClass>(config);Assert.Multiple(()=>Assert.Equal(100,result1.Value),()=>Assert.Equal(30,result2.Value));}}publicclassSourceClass{publicboolUseSecondaryValue{get;set;}publicint?PrimaryValue{get;set;}publicint?SecondaryValue1{get;set;}publicint?SecondaryValue2{get;set;}}publicclassDestinationClass{publicintValue{get;set;}}This seems to be something related to using a ternary conditional in the source selector in .Map and the properties on SourceClass being nullable.
Appreciate this is a strange example and that there are definitely other ways it can be achieved, but it definitely used to work and hopefully highlights the issue.
Using .NET 10.
The following sample unit test passes in v10.0.6, but fails in 10.0.7 where
result1is 0.This seems to be something related to using a ternary conditional in the source selector in
.Mapand the properties onSourceClassbeing nullable.Appreciate this is a strange example and that there are definitely other ways it can be achieved, but it definitely used to work and hopefully highlights the issue.
Using .NET 10.