Skip to content

Decoder.Convert and Encoder.Convert have buggy sample code #3641

Open
@GrabYourPitchforks

Description

@GrabYourPitchforks

(Placeholder while I spend some time formalizing the issue and coming up with new sample code.)

The sample code at https://docs.microsoft.com/en-us/dotnet/api/system.text.decoder.convert and https://docs.microsoft.com/en-us/dotnet/api/system.text.encoder.convert (all Framework versions) demonstrates using the Convert methods incorrectly, as they make incorrect assumptions about the behavior of the completed out parameter. We should update the sample code to show correct API usage.

This is particularly problematic in .NET Core 3.x, where bug fixes in the Encoder.Convert and Decoder.Convert methods may cause the sample code present in the docs to go into an infinite loop. See https://github.com/dotnet/corefx/issues/42423 for one such example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3Indicates issues/PRs that are low priorityarea-System.Text.Encodingdoc-bugProblem with the content; needs to be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions