Skip to content

Commit a13ba0c

Browse files
committed
CSHARP-4110: Remove initialCount upper bound check in SemaphoreSlimSignalable
1 parent 91b54b7 commit a13ba0c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/MongoDB.Driver.Core/Core/Misc/SemaphoreSlimSignalable.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ public void Dispose()
8686

8787
public SemaphoreSlimSignalable(int initialCount)
8888
{
89-
// reasonable upper bound for initialCount to ensure overall correctness
90-
Ensure.IsBetween(initialCount, 0, 1024, nameof(initialCount));
89+
Ensure.IsGreaterThanOrEqualToZero(initialCount, nameof(initialCount));
9190

9291
_semaphore = new SemaphoreSlim(initialCount);
9392
_syncRoot = new object();

tests/MongoDB.Driver.Core.Tests/Core/Misc/SemaphoreSlimSignalableTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ public class SemaphoreSlimSignalableTests
2828
{
2929
[Theory]
3030
[ParameterAttributeData]
31-
public void Constructor_should_check_arguments([Values(-2, -1, 1025)] int count)
31+
public void Constructor_should_check_arguments([Values(-2, -1)] int count)
3232
{
3333
var exception = Record.Exception(() => new SemaphoreSlimSignalable(count));
3434

3535
var e = exception.Should().BeOfType<ArgumentOutOfRangeException>().Subject;
3636
e.ParamName.Should().Be("initialCount");
37-
e.Message.Should().StartWith("Value is not between");
37+
e.Message.Should().StartWith("Value is not greater than or equal to 0");
3838
}
3939

4040
[Theory]

0 commit comments

Comments
 (0)