You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assert.That().IsNotNull() don't suppress nullable warnings for some code after the Assert.
The following code gives a warning CS8629 "Nullable value type may be null." when the Id is guaranteed to be not null after the Assert.
For example with an extra if ... is not null, the compiler can suppress the warning :
[Test][Arguments(1)]publicasyncTaskCheckNull(int?id){varvalue=new{Id=id};awaitAssert.That(value.Id).IsNotNull();if(value.Idis not null){awaitAssert.That(value.Id.Value).EqualTo(0);}}
Feature Category
Other
How important is this feature to you?
Nice to have - would improve my experience
Additional Context
No response
Contribution
I'm willing to submit a pull request for this feature
Problem Statement
Hi,
Assert.That().IsNotNull()don't suppress nullable warnings for some code after the Assert.The following code gives a warning CS8629 "Nullable value type may be null." when the Id is guaranteed to be not null after the Assert.
Proposed Solution
Alternatives Considered
For example with an extra
if ... is not null, the compiler can suppress the warning :Feature Category
Other
How important is this feature to you?
Nice to have - would improve my experience
Additional Context
No response
Contribution