Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression or document breaking change in BinaryReader #93500

Closed
jozkee opened this issue Oct 14, 2023 · 8 comments
Closed

Fix regression or document breaking change in BinaryReader #93500

jozkee opened this issue Oct 14, 2023 · 8 comments
Assignees
Labels
area-System.IO breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. documentation Documentation bug or enhancement, does not impact product or test code
Milestone

Comments

@jozkee
Copy link
Member

jozkee commented Oct 14, 2023

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

@ghost
Copy link

ghost commented Oct 14, 2023

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Issue Details

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

Author: Jozkee
Assignees: -
Labels:

area-System.IO, regression-from-last-release

Milestone: 9.0.0

@adamsitnik
Copy link
Member

I've missed the notification. @teo-tsirpanis PTAL

@teo-tsirpanis
Copy link
Contributor

This new behavior seems the correct one, and matches Unicode standards, and a breaking change done in .NET Core 3.0.

@jeffhandley
Copy link
Member

Thanks, @teo-tsirpanis! Closing this issue since the new behavior is correct and intentional, and it was documented.

@jozkee
Copy link
Member Author

jozkee commented Aug 6, 2024

@jeffhandley that document is for 3.0, it may be surprising for customers jumping from 8.0 or lower to not find this documented as part of 9.0 breaking changes.

@jeffhandley jeffhandley reopened this Aug 6, 2024
@jeffhandley jeffhandley added documentation Documentation bug or enhancement, does not impact product or test code and removed regression-from-last-release labels Aug 6, 2024
@jozkee jozkee added breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet labels Aug 6, 2024
Copy link
Contributor

Added needs-breaking-change-doc-created label because this issue has the breaking-change label.

  1. Create and link to this issue a matching issue in the dotnet/docs repo using the breaking change documentation template, then remove this needs-breaking-change-doc-created label.

Tagging @dotnet/compat for awareness of the breaking change.

@jozkee jozkee removed the needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet label Sep 10, 2024
@jozkee
Copy link
Member Author

jozkee commented Sep 11, 2024

dotnet/docs#42564

@jeffhandley
Copy link
Member

Closed as we concluded we just needed to document this and it was captured in dotnet/docs#42564

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.IO breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. documentation Documentation bug or enhancement, does not impact product or test code
Projects
None yet
Development

No branches or pull requests

4 participants