dotnet / dotnet/dotnet-api-docs
Decoder.Convert and Encoder.Convert have buggy sample code
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
(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.
Contributor guide
Assessment
This issue has not been assessed yet.