Skip to content

Commit

Permalink
for netcore app need use more large buffer cause
Browse files Browse the repository at this point in the history
stream.CopyTo work incorrect, this bug occurce aftter https://github.com/dotnet/corefx/issues/4547 introduced
  • Loading branch information
tw-aleksandergrechishkin committed Feb 16, 2018
1 parent 8c0ac86 commit 3ab90a0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ProtoBuf.Data/ProtoDataStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ public class ProtoDataStream : Stream
/// <summary>
/// Buffer size.
/// </summary>
#if NETSTANDARD2_0
// cause netcoreapp2.0 use shared buffer they allocate buffer more than requested 80Kb
public const int DefaultBufferSize = 256 * 1024;
#else
public const int DefaultBufferSize = 128 * 1024;
#endif

private readonly ProtoDataWriterOptions options;
private readonly ProtoDataColumnFactory columnFactory;
Expand Down Expand Up @@ -127,8 +132,8 @@ public ProtoDataStream(IDataReader reader, int bufferSize = DefaultBufferSize)
/// You should not need to change this unless you have exceptionally
/// large rows or an exceptionally high number of columns.</param>
public ProtoDataStream(
IDataReader reader,
ProtoDataWriterOptions options,
IDataReader reader,
ProtoDataWriterOptions options,
int bufferSize = DefaultBufferSize)
{
if (reader == null)
Expand Down

0 comments on commit 3ab90a0

Please sign in to comment.