Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CA2022 is incompatible with .NET Framework 4.8 #7494

Open
N-Olbert opened this issue Dec 3, 2024 · 0 comments
Open

CA2022 is incompatible with .NET Framework 4.8 #7494

N-Olbert opened this issue Dec 3, 2024 · 0 comments

Comments

@N-Olbert
Copy link

N-Olbert commented Dec 3, 2024

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 exist

Steps To Reproduce

  1. Create new .NET Framework 4.8 console app.
  2. Insert the following method anywhere:
        void M1(Stream stream, byte[] buffer)
        {
            // CA2022 violation.
            stream.Read(buffer, 0, buffer.Length);
        }

Expected behavior

No warning at all

Actual behavior

CA2022 violation reported

Additional context

#7208
#69159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant