You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are correct that the suggested method ReadExactly does not exist in .NET Framework 4.8. But the doc page suggests another way to fix the violation:
To fix a violation, either check the return value (which is the total number of bytes read into the buffer) ...
When you check the return value (which is the recommended approach and the reason this rule exists, see here) the violation is no longer reported.
Analyzer
Diagnostic ID: CA2022:
Avoid inexact read with Stream.Read
Analyzer source
NuGet Package: Microsoft.CodeAnalysis.NetAnalyzers
Version: 9.0.0
Describe the bug
This rule raises an issue within .NET Framework 4.8, but the suggested method
ReadExactly
does not existSteps To Reproduce
Expected behavior
No warning at all
Actual behavior
CA2022 violation reported
Additional context
#7208
#69159
The text was updated successfully, but these errors were encountered: