diff --git a/src/ImageSharp/Configuration.cs b/src/ImageSharp/Configuration.cs index b96204ed9e..062bcb229c 100644 --- a/src/ImageSharp/Configuration.cs +++ b/src/ImageSharp/Configuration.cs @@ -25,8 +25,6 @@ namespace SixLabors.ImageSharp /// A lazily initialized configuration default instance. /// private static readonly Lazy Lazy = new Lazy(CreateDefaultInstance); - - private const int MinStreamProcessingBufferSize = 128; private const int DefaultStreamProcessingBufferSize = 8096; private int streamProcessingBufferSize = DefaultStreamProcessingBufferSize; private int maxDegreeOfParallelism = Environment.ProcessorCount; @@ -79,17 +77,16 @@ namespace SixLabors.ImageSharp /// /// Gets or sets the size of the buffer to use when working with streams. - /// Intitialized with by default - /// and can accept a minimum value of . + /// Intitialized with by default. /// public int StreamProcessingBufferSize { get => this.streamProcessingBufferSize; set { - if (value < MinStreamProcessingBufferSize) + if (value <= 0) { - value = MinStreamProcessingBufferSize; + throw new ArgumentOutOfRangeException(nameof(this.StreamProcessingBufferSize)); } this.streamProcessingBufferSize = value; diff --git a/tests/ImageSharp.Tests/ConfigurationTests.cs b/tests/ImageSharp.Tests/ConfigurationTests.cs index 32fd5202c6..655e98c7f6 100644 --- a/tests/ImageSharp.Tests/ConfigurationTests.cs +++ b/tests/ImageSharp.Tests/ConfigurationTests.cs @@ -141,12 +141,10 @@ namespace SixLabors.ImageSharp.Tests [Fact] public void StreamBufferSize_CannotGoBelowMinimum() { - var config = new Configuration - { - StreamProcessingBufferSize = 0 - }; + var config = new Configuration(); - Assert.Equal(128, config.StreamProcessingBufferSize); + Assert.Throws( + () => config.StreamProcessingBufferSize = 0); } } }