All rules
CA2022Reliability Enabled by default: As warning
Avoid inexact read with Stream.Read
Avoid inexact read with Stream.Read
Microsoft docsDescription
System.IO.Stream.Read and System.IO.Stream.ReadAsync might return fewer bytes than requested, resulting in unreliable code if the return value isn't checked.
Cause
A call to System.IO.Stream.Read or System.IO.Stream.ReadAsync is made and the return value isn't checked.
How to fix violations
To fix a violation, either check the return value (which is the total number of bytes read into the buffer) or call System.IO.Stream.ReadExactly or System.IO.Stream.ReadExactlyAsync instead.
When to suppress
You shouldn't suppress warnings from this rule, as your app might hang if you don't fix the violations.
Your vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0