Nullable Reference Types and Should().NotBeNull() #1750
-
Hey guys 👋🏻 When using Nullable Reference Types, the following code gives me a compiler warning [Fact]
public void Test()
{
var testee = GetHttpResponse();
testee.Should().NotBeNull();
testee.StatusCode.Should().Be(HttpStatusCode.Accepted);
}
private HttpResponseMessage? GetHttpResponse() => new HttpResponseMessage(HttpStatusCode.Accepted); Since I'm doing an explicit null check before, this warning is a false positive. Can the null-state analysis attributes help us to avoid the misleading warning? |
Beta Was this translation helpful? Give feedback.
Answered by
dennisdoomen
Nov 24, 2021
Replies: 1 comment 1 reply
-
It's a difficult discussion. See #1115 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
mu88
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's a difficult discussion. See #1115