Repository navigation
Install: Csv 3.0.0 on nuget.org.
Changed
- Breaking: target frameworks are now
netstandard2.0andnet10.0(droppednet8.0andnet9.0)- .NET 8/9 apps now resolve the
netstandard2.0build, which lacks the Span/Memory APIs (ReadAsSpan,ReadFromMemoryOptimized,CsvBufferWriter, ...)
- .NET 8/9 apps now resolve the
- Removed the stale
NetStandardImplicitPackageVersion1.6.0 pin; it broke thenetstandard2.0build once NuGet package pruning kicked in fornet10.0
Fixed
- ReadFromStreamAsync and ReadFromTextAsync dropping cancellation tokens when consumed with .WithCancellation(ct)
- Async enumerator implementations now carry [EnumeratorCancellation] and forward tokens to the underlying reader engine
CsvWriternot quoting fields that contain a bare carriage return (\r)- Per RFC 4180 a field containing CR, LF, the separator, or a quote must be quoted;
CsvWriteronly triggered on\n, the separator,', and", so a value likea\rbwas written unquoted — mis-parsed by strict readers and split into two records when re-read CsvBufferWriteralready included\r; allCsvWriterpaths (sync, async, and theReadOnlyMemory<char>paths) now match it
- Per RFC 4180 a field containing CR, LF, the separator, or a quote must be quoted;
Performance
- Removed a per-row
char[]allocation inCsvWriter.WriteLine/WriteLineAsyncby caching the fixed quote-trigger characters in a static array and checking the variable separator separately - Reader: 40–55% fewer bytes allocated and 10–35% faster on net10.0
- Line splitting jumps between separators/quotes with vectorized
IndexOfAnyand returns an exact-size array instead of aList - Field trimming/unquoting reuses the split array instead of copying it
- Escaped quotes are unescaped in one pass with a single allocation (was one allocation per escape)
ReadFromText/ReadFromTextAsSpanslice the input string instead of allocating a string per line;Rawis materialized on first access and cached
- Line splitting jumps between separators/quotes with vectorized
- Writer: quoted fields containing
"are written in segments instead of viastring.Replace/ per-char writes on net10.0
Full changes: 7b3f998...v3.0.0 (since 2.0.245)
🤖 Generated with Claude Code