Fix StringSegment.Buffer can be null#57858
Conversation
|
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. |
|
Tagging subscribers to this area: @eerhardt, @maryamariyan Issue DetailsAddresses: #57395 (comment)
|
src/libraries/Microsoft.Extensions.Primitives/src/StringSegment.cs
Outdated
Show resolved
Hide resolved
…t.cs Co-authored-by: Günther Foidl <gue@korporal.at>
|
Perhaps also add a test where null is passed to .ctor(String), and assert that:
|
|
There is one already: https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.Primitives/tests/StringSegmentTest.cs#L164 Update: Added more asserts in it |
|
@maxkoshevoi Missed that one, thx. |
src/libraries/Microsoft.Extensions.Primitives/src/StringSegment.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Primitives/tests/StringSegmentTest.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Primitives/tests/StringSegmentTest.cs
Show resolved
Hide resolved
|
FYI this PR is blocking the runtime -> aspnetcore merge: dotnet/aspnetcore#35547 If it is in a good state (@eerhardt or @stephentoub could you review the latest changes?) then it would be great to get it merged and unblock updates. |
|
Thanks for fixing it. |
Addresses: #57395 (comment)
BuffernullableEquals(text)returnstrueif bothBufferandtextare null