You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] - StreamReaderFunc in CsvConfiguration ignores BufferSize and uses a hardcoded value instead #1003
CsvConfiguration inherits BufferSize from MiniExcelBaseConfiguration (default 1024 * 512), but the default StreamReaderFunc ignores it and hardcodes a buffer size of 1024:
Because these are field initializers, they can't reference this.BufferSize directly, so 1024 was likely used as a placeholder. As a result, changing BufferSize on a CsvConfiguration instance has no effect on the StreamReader's (or StreamWriter's) actual buffer size, which is misleading and can hurt performance for large files.
Expected Behavior
StreamReaderFunc (and StreamWriterFunc) should use the configured BufferSize value when constructing the default StreamReader/StreamWriter.
Actual Behavior
StreamReaderFunc always uses a hardcoded buffer size of 1024, regardless of the BufferSize value set on the configuration. StreamWriterFunc similarly does not use BufferSize at all.
Workarounds
Consumers can manually override StreamReaderFunc/StreamWriterFunc to use their desired buffer size.
Environment (please fill the following information):
Suggested fix: Use a nullable backing field with a lazily-initialized default, so the lambda is created on first access (after BufferSize may have been customized), without needing a constructor:
privateFunc<Stream,StreamReader>?_streamReaderFunc;publicFunc<Stream,StreamReader>StreamReaderFunc{
get =>_streamReaderFunc??= stream =>newStreamReader(stream,DefaultEncoding,true,BufferSize,true);
set =>_streamReaderFunc=value;}privateFunc<Stream,StreamWriter>?_streamWriterFunc;publicFunc<Stream,StreamWriter>StreamWriterFunc{
get =>_streamWriterFunc??= stream =>newStreamWriter(stream,DefaultEncoding,BufferSize,true);
set =>_streamWriterFunc=value;}
Activity
evgenyvalavin commentedon Sep 8, 2026
Reproduced on a 140 mb file using stream.Query<>(). Read speed is about 6-7 mbit/s. Takes ~4 minutes to fully query the file.
Fix: CsvConfiguration StreamReaderFunc/StreamWriterFunc ignore Buffer…