Full Gist
https://gist.github.com/Biotronic/a58e42bde29f2208cd8958082c45d9d5
Source/destination types
public class Class1
{
public TimeSpan X { get; set; }
}
public class Class2
{
public Class2(in TimeSpan x)
{
}
}
Mapping configuration
var config = new MapperConfiguration(cfg => { cfg.CreateMap<Class1, Class2>(); });
Version: 13.0.1
Expected behavior
Either for the mapping to just work, or an understandable error message to be displayed.
Something like 'AutoMapper cannot map in
parameters (parameter x
in Class2.ctor
)'
Actual behavior
System.ArgumentException: Type must not be ByRef (Parameter 'type')
With an opaque call stack that says very little about what's actually wrong.
Steps to reproduce
Just run the Gist