I believe it is related to this issue: dotnet/runtime#27552
public class SourceClass
{
public IEnumerable<string> Values { get; set; }
}
public class TargetClass
{
public IEnumerable<string> Values { get; set; }
}
var config = new MapperConfiguration(cfg => cfg.CreateMap<SourceClass, TargetClass>());
var mapper = new Mapper(config);
var source = new SourceClass { Values = new string[0] };
var existingTarget = new TargetClass { Values = Enumerable.Empty<string>() };
// This line throws in netcoreapp3.1 but not in netcoreapp2.2
mapper.Map(source, existingTarget);
Expected behavior
Not to throw an exception.
Actual behavior
Unable to cast object of type 'System.Linq.EmptyPartition`1[System.String]' to type 'System.Collections.Generic.IList`1[System.String]'.
I believe it is related to this issue: dotnet/runtime#27552
Expected behavior
Not to throw an exception.
Actual behavior