Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabYourPitchforks committed May 9, 2020
1 parent 73003ac commit 9a70a2b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
3 changes: 1 addition & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
<UsingToolMicrosoftNetCompilers>true</UsingToolMicrosoftNetCompilers>
<UsingToolIbcOptimization>true</UsingToolIbcOptimization>
<UsingToolXliff>false</UsingToolXliff>
<!-- Downgrade compiler version to fix nullability issues: https://github.com/dotnet/runtime/issues/34417. -->
<!-- <MicrosoftNetCompilersToolsetVersion>3.6.0-2.20166.2</MicrosoftNetCompilersToolsetVersion> -->
<!-- Upgrade compiler version to work around build failures: https://github.com/dotnet/runtime/issues/34417. -->
<MicrosoftNetCompilersToolsetVersion>3.7.0-2.20258.1</MicrosoftNetCompilersToolsetVersion>
<!-- Blob storage container that has the "Latest" channel to publish to. -->
<ContainerName>dotnet</ContainerName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,13 +756,10 @@ private bool TryTakeWithNoTimeValidation([MaybeNullWhen(false)] out T item, int
}
}

if (waitForSemaphoreWasSuccessful)
{
Debug.Assert(item != null);
}

#pragma warning disable CS8762
// Compiler can't automatically deduce 'item' has a non-null value when returning false.
// https://github.com/dotnet/runtime/issues/36132
// Compiler can't automatically deduce that nullability constraints
// for 'item' are satisfied at this exit point.
return waitForSemaphoreWasSuccessful;
#pragma warning restore CS8762
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@ private bool TrySteal([MaybeNullWhen(false)] out T result, bool take)
if (gotItem)
{
#pragma warning disable CS8762
// Compiler can't automatically deduce that 'result' is set to a valid value
// (which may be null if T allows it) at this exit point.
// https://github.com/dotnet/runtime/issues/36132
// Compiler can't automatically deduce that nullability constraints
// for 'result' are satisfied at this exit point.
return true;
#pragma warning restore CS8762
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,22 @@ public static void Test21_CopyToExceptions()
});
}

[Fact]
public static void Test_WithNullEntries()
{
BlockingCollection<string> collection = new BlockingCollection<string>()
{
"hello",
null,
"goodbye"
};

Assert.Equal("hello", collection.Take());
Assert.Null(collection.Take());
Assert.Equal("goodbye", collection.Take());
Assert.False(collection.TryTake(out _));
}

[Fact]
public static void Test_LargeSize()
{
Expand Down

0 comments on commit 9a70a2b

Please sign in to comment.