TSV - Exception on blank field value
Unit test to reproduce the problem: `
public class ChoTests
{
[Fact]
public void CanReadTabDelimitedWithBlankFieldValue()
{
using (var reader = ChoTSVReader.LoadText("A\t\tB").ErrorMode(ChoErrorMode.ThrowAndStop))
{
foreach(var record in reader)
{
Assert.NotNull(record);
Assert.Equal("A", record.Column1);
Assert.Null(record.Column2);
Assert.Equal("B", record.Column3);
}
}
}
}
`
This throws an exception, when it should gracefully populate the record. It is apparently a side effect of the delimiter (tab) being considered whitespace. Stack trace: `
at ChoETL.ChoUtility.RightOf(String source, String searchText) at ChoETL.ChoCSVRecordReader.GetFieldValues(String line) at ChoETL.ChoCSVRecordReader.FillRecord(Object rec, Tuple2 pair) at ChoETL.ChoCSVRecordReader.LoadLine(Tuple2 pair, Object& rec) at ChoETL.ChoCSVRecordReader.AsEnumerable(Object source, TraceSwitch traceSwitch, Func2 filterFunc)+MoveNext() at ChoETL.ChoEnumeratorWrapper.BuildEnumerable[T](Func1 moveNext, Func1 current, Action dispose)+MoveNext() `
Applied fix, released v1.2.1.60
Sample fiddle: https://dotnetfiddle.net/9kp7Aw