dotnet/coreclr#24676 describes a jit bug in .Net Core 2.1 and 2.2 that impacts Automapper when used in conjunction with a profiler. The bug happens only on Linux x64, and involves struct types that need more than 8 bytes of storage (eg Nullable<long>).
If anyone has hit this bug can you add information to the issue linked above?
I didn't see anything similar here or on SO.
Sample stack trace for this errors:
Unhandled Exception: System.EntryPointNotFoundException: Entry point was not found.
at AutoMapper.IMemberMap.get_UseDestinationValue()
at AutoMapper.Execution.ExpressionBuilder.NullCheckSource(ProfileMap profileMap, Expression sourceParameter, Expression destinationParameter, Expression objectMapperExpression, IMemberMap memberMap)
at AutoMapper.Execution.ExpressionBuilder.MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, TypePair typePair, Expression sourceParameter, Expression contextParameter, IMemberMap propertyMap, Expression destinationParameter)
at AutoMapper.Mappers.NullableDestinationMapper.MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression)
at AutoMapper.Execution.ExpressionBuilder.MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, TypePair typePair, Expression sourceParameter, Expression contextParameter, IMemberMap propertyMap, Expression destinationParameter)
at AutoMapper.Mappers.NullableSourceMapper.MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression)
at AutoMapper.Execution.ExpressionBuilder.MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, TypePair typePair, Expression sourceParameter, Expression contextParameter, IMemberMap propertyMap, Expression destinationParameter)
at AutoMapper.Execution.TypeMapPlanBuilder.CreatePropertyMapFunc(IMemberMap memberMap, Expression destination, MemberInfo destinationMember)
at AutoMapper.Execution.TypeMapPlanBuilder.TryPropertyMap(PropertyMap propertyMap)
at AutoMapper.Execution.TypeMapPlanBuilder.CreateAssignmentFunc(Expression destinationFunc)
at AutoMapper.Execution.TypeMapPlanBuilder.CreateMapperLambda(HashSet`1 typeMapsPath)
at AutoMapper.TypeMap.Seal(IConfigurationProvider configurationProvider)
at AutoMapper.MapperConfiguration.Seal()
at AutoMapper.MapperConfiguration..ctor(MapperConfigurationExpression configurationExpression)
at AutoMapper.Mapper.Initialize(Action`1 config)
System.EntryPointNotFoundException: Entry point was not found.
at AutoMapper.IMemberMap.get_UseDestinationValue()
at AutoMapper.Mappers.Internal.CollectionMapperExpressionFactory.<MapCollectionExpression>g__UseDestinationValue|1_0(<>c__DisplayClass1_0& )
at AutoMapper.Mappers.Internal.CollectionMapperExpressionFactory.MapCollectionExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression, Type ifInterfaceType, MapItem mapItem)
at AutoMapper.Mappers.CollectionMapper.MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression)
at AutoMapper.Execution.ExpressionBuilder.MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, TypePair typePair, Expression sourceParameter, Expression contextParameter, IMemberMap propertyMap, Expression destinationParameter)
at AutoMapper.Execution.TypeMapPlanBuilder.CreatePropertyMapFunc(IMemberMap memberMap, Expression destination, MemberInfo destinationMember)
at AutoMapper.Execution.TypeMapPlanBuilder.TryPropertyMap(PropertyMap propertyMap)
at AutoMapper.Execution.TypeMapPlanBuilder.CreateAssignmentFunc(Expression destinationFunc)
at AutoMapper.Execution.TypeMapPlanBuilder.CreateMapperLambda(HashSet`1 typeMapsPath)
at AutoMapper.TypeMap.Seal(IConfigurationProvider configurationProvider)
at AutoMapper.MapperConfiguration.Seal()
at AutoMapper.MapperConfiguration..ctor(MapperConfigurationExpression configurationExpression)
In both cases object that is used to call AutoMapper.IMemberMap.get_UseDestinationValue() do not implement IMemberMap interface, as due too mentioned CLR issue incorrect argument was from function (in first case ExpressionBuilder.ObjectMapperExpression is responsble for it, but not visible in stack trace as tail call was used to call NullableSourceMapper.MapExpression).
Another profiler hited by same issue: DataDog/dd-trace-dotnet#302
Thanks for calling this github issue to our attention, @iskiselev. Here's a minimal repro using AutoMapper:
public class Program
{
public static void Main()
{
Mapper.Initialize(
configuration =>
{
configuration.CreateMap<Model1, Model2>();
});
}
}
public class Model1
{
public List<string> Items { get; set; }
}
public class Model2
{
// changing this to string[] avoids the problem
public List<string> Items { get; set; }
}
Can repro on Linux with .NET Core 2.1 and 2.2, not on Windows.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Another profiler hited by same issue: DataDog/dd-trace-dotnet#302