Uh oh!
There was an error while loading. Please reload this page.
[Group 1] Enable nullable annotations for Microsoft.Extensions.Primitives - #57395
Conversation
ghost
commented
Aug 14, 2021
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| public override bool Equals(object obj) { throw null; } | ||
| public bool Equals(string text) { throw null; } | ||
| public override bool Equals(object? obj) { throw null; } | ||
| public bool Equals(string? text) { throw null; } |
There was a problem hiding this comment.
Interestingly, in implementation text is non-nullable and everything compiles fine
There was a problem hiding this comment.
It doesn't allow me to make it non-nullable...
You need to change the type of the interface being implemented to IEquatable<string?>.
in implementation text is non-nullable and everything compiles fine
Yes, because the code never tries to dereference a maybe-null value. The first thing the code does is check whether it's null and throw if it is.
There was a problem hiding this comment.
Sorry, I misread what you'd written. IEquatable<T> is defined to expect Equals always allows null (it accepts a T?), which is why this is complaining about trying to specify a non-nullable value. I think the implementation should be changed to return false rather than throwing, and then typed as string?, but I'll defer here to @dotnet/area-microsoft-extensions area owners.
There was a problem hiding this comment.
Made it return false.
Microsoft.Extensions.Primitivesghost
commented
Aug 16, 2021
Tagging subscribers to this area: @eerhardt, @maryamariyan Issue DetailsRelated to #43605
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
krwq
left a comment
There was a problem hiding this comment.
LGTM, thank you a lot for this contribution!
eerhardt
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the contribution!
BrennanConroy
commented
Aug 20, 2021
I think StringSegment needs another look, Buffer is allowed to be null so you can distinguish between string.Empty and a null string. This is causing issues in AspNetCore when trying to consume the Runtime update because we expect to be able to pass null to StringSegment. dotnet/aspnetcore#35547 |
maxkoshevoi
commented
Aug 20, 2021
Oh, I see. Second constructor thrown me off (it throws if |
Shouldn't |


Related to #43605