Skip to content

Fix regression or document breaking change in BinaryReader #93500

@jozkee

Description

@jozkee

Follow-up to #80331 (comment).

On the following code:

var ms = new MemoryStream(new byte[] { 0x01, 0xC2 });
using (var br = new BinaryReader(ms))
{
    string s = br.ReadString();

    Console.WriteLine(s);
    Console.WriteLine(s.Length);
    Console.WriteLine(s == "\uFFFD");
}

ReadString returns empty string on .NET 8 or prior. After #80331, it returns "\uFFFD".

Thanks @GrabYourPitchforks for pointing the error after merge and share the affected scenario in question.
cc @teo-tsirpanis @adamsitnik

Metadata

Metadata

Assignees

Labels

area-System.IObreaking-changeIssue or PR that represents a breaking API or functional change over a previous release.documentationDocumentation bug or enhancement, does not impact product or test code

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions