JoshClose / CsvHelper

Library to help reading and writing CSV files
http://joshclose.github.io/CsvHelper/
Other
4.65k stars 1.05k forks source link

Always update CsvReader.ColumnCount #2163

Closed Rob-Hague closed 6 months ago

Rob-Hague commented 1 year ago

Fixes #1779

Rand-Random commented 12 months ago

maybe the test should also validate if columncount decreases on rows with fewer columns, as to check that columcount is a max(columcount)

Rob-Hague commented 12 months ago

maybe the test should also validate if columncount decreases on rows with fewer columns, as to check that columcount is a max(columcount)

Thanks. I've strengthened the test, but actually that is not the current behaviour when DetectColumnCountChanges is true: the test passes on master when DetectColumnCountChanges is true (i.e. ColumnCount always changes) but fails when it is false (ColumnCount always returns 0). With the PR the test passes for both cases.

I also removed my misleading comment on columnCount and renamed it to prevColumnCount.