Skip to content

StringSegment doesn't handle null buffers consistently #45021

@GrabYourPitchforks

Description

@GrabYourPitchforks

Microsoft.Extensions.Primitives.StringSegment does not handle null backing buffers consistently. One example:

Console.WriteLine(default(StringSegment).IndexOfAny(new[] { 'x' })); // prints -1
Console.WriteLine(default(StringSegment).IndexOf('x')); // throws ArgumentOutOfRangeException
Console.WriteLine(default(StringSegment).LastIndexOf('x')); // prints -1

(Related: #39140)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions