Read from CSV: retarget net10.0, fix the discarded configuration, add the missing data file and real tests - #2196
Merged
vladimir-pecanac-main merged 2 commits intoSep 18, 2026
Conversation
… the missing data file and real tests - ReadFromCsv and ReadFromCsvTests move from net6.0 to net10.0 - CsvHelper 27.2.1 to 33.1.0, Microsoft.NET.Test.Sdk 16.11.0 to 18.10.0, MSTest 2.2.7 to 4.4.0, coverlet.collector 3.1.0 to 10.0.1 - ReadPersons() now passes its CsvConfiguration to the CsvReader, so HasHeaderRecord = false takes effect and the first data row is no longer consumed as a header, and materialises the records with ToList() so the file is actually read - Add the missing filePersons.csv and copy it to the output folder, so the sample runs instead of throwing FileNotFoundException - File-scoped namespaces, and PersonMap moves into the ReadFromCsv namespace - Tests assert field values instead of a count that cannot fail, with the expected data matching the input and dates parsed with InvariantCulture, plus new tests for the headerless read, a quoted comma, comments with and without AllowComments, TextFieldParser against string.Split, and ReadingExceptionOccurred skipping a bad row
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the sample behind the "How to Read Data From a CSV File in C#" article.
Build and tests: 0 warnings, 0 errors, 7 of 7 passing on .NET 10.0.10 (SDK 10.0.302).