dotnet / dotnet/docs

Suggest using streamreader instead of iterating over the stream

Open
#33,488 0 comments 0 reactions 0 assignees View on GitHub
dotnet-fundamentals/svc help wanted
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
19h 10m
Merged PRs (30d)
268

Description

In the recommended section, you should suggest the use of StreamReader instead of manually iterating over the Stream :
using (var plainTextReader = new StreamReader(cryptoStream))
{
return plainTextReader.ReadToEnd();
}

reference : https://stackoverflow.com/questions/69911084/problem-updating-to-net-6-encrypting-string

Thanks !

---
#### Document Details

⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*

* ID: 8ad66e79-695d-65b2-c85a-b857283e9aee
* Version Independent ID: febfa9c4-1fb2-0bc6-d23a-ed2e9425aeed
* Content: [Breaking change: Partial and zero-byte reads in DeflateStream, GZipStream, and CryptoStream - .NET](https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/partial-byte-reads-in-streams)
* Content Source: [docs/core/compatibility/core-libraries/6.0/partial-byte-reads-in-streams.md](https://github.com/dotnet/docs/blob/main/docs/core/compatibility/core-libraries/6.0/partial-byte-reads-in-streams.md)
* Product: **dotnet-fundamentals**
* GitHub Login: @gewarren
* Microsoft Alias: **gewarren**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.