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 Special-case MemoryStream and UnmanagedMemoryStream and don't issue diagnostic #7268

Closed
buyaa-n opened this issue Mar 26, 2024 · 1 comment · Fixed by #7269
Closed
Labels
False_Positive A diagnostic is reported for non-problematic case

Comments

@buyaa-n
Copy link
Member

buyaa-n commented Mar 26, 2024

Special-case MemoryStream and UnmanagedMemoryStream where if we can prove the target Stream is one of those we don't issue diagnostic. Those, in particular the former, are commonly used and we know they are actually safe for this usage; I'd like to avoid causing a lot of noise around them. While we don't necessarily document it's safe, we also don't need to cause folks to do a lot of work in response.

          Can we special-case MemoryStream and UnmanagedMemoryStream where if we can prove the target Stream is one of those we don't issue diagnostics?  Those, in particular the former, are commonly used and we know they are actually safe for this usage; I'd like to avoid causing a lot of noise around them. While we don't necessarily document it's safe, we also don't need to cause folks to do a lot of work in response.

Originally posted by @stephentoub in #7208 (comment)

@buyaa-n buyaa-n changed the title Special-case MemoryStream and UnmanagedMemoryStream and don't issue diagnostics CA2022 Special-case MemoryStream and UnmanagedMemoryStream and don't issue diagnostic Mar 26, 2024
@buyaa-n buyaa-n added the False_Positive A diagnostic is reported for non-problematic case label Mar 26, 2024
@paulomorgado
Copy link
Contributor

Make sure Microsoft.IO.RecyclableMemoryStream is not excluded.

/cc @benmwatson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False_Positive A diagnostic is reported for non-problematic case
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants