Can anyone help me understand why this piece of code is throwing a NullReferenceException?
public static ScreenField ToDto(this FieldDefinition @from, IList<ScreenData> screenData)
if (@from == null)
var to = @from.ConvertTo<ScreenField>(); // <--- exception thrown here
The stack trace simply reads:
at ServiceStack.AutoMappingUtils.ChangeValueType(Object from, Type toType)
And I get the same result if I change the variable declaration to
var to = new ScreenField().PopulateWith(@from);
You'd need to provide the full source-code in order for anyone else to be able to repro the issue.
The project's colossal. This ToDto method is just an extension method. What specifically do you need the source of?
Is it just the Types?
I'd need something I can run locally that repros the issue, e.g. an MCVE.