Describe the bug
The class cannot load CSVs with missing columns into record types, despite the record type having a default argument for optional columns.
route_id,agency_id,route_short_name,route_long_name,route_type,route_text_color,route_color,route_url,route_desc
1,=GW,GWR,Great Western Railway,2,,0a493e,,
Expected behaviour
A record should be loaded, with the default values used for missing columns.
Actual behaviour
An exception is thrown.
---> System.ArgumentException: Incorrect number of arguments for constructor
at System.Dynamic.Utils.ExpressionUtils.ValidateArgumentCount(MethodBase method, ExpressionType nodeKind, Int32 count, ParameterInfo[] pis)
at System.Dynamic.Utils.ExpressionUtils.ValidateArgumentTypes(MethodBase method, ExpressionType nodeKind, ReadOnlyCollection`1& arguments, String methodParamName)
at System.Linq.Expressions.Expression.New(ConstructorInfo constructor, IEnumerable`1 arguments)
at CsvHelper.Expressions.ObjectRecordCreator.CreateCreateRecordDelegate(Type recordType)
at CsvHelper.Expressions.RecordCreator.GetCreateRecordDelegate[T](Type recordType)
at CsvHelper.Expressions.RecordManager.GetReadDelegate[T](Type recordType)
at CsvHelper.CsvReader.GetRecordsAsync[T](CancellationToken cancellationToken)+MoveNext()
Describe the bug The class cannot load CSVs with missing columns into record types, despite the record type having a default argument for optional columns.
To Reproduce
Expected behaviour A record should be loaded, with the default values used for missing columns.
Actual behaviour An exception is thrown.