Closed mpidash closed 3 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.48%. Comparing base (
0868ca2
) to head (d454355
).
Let me know if we want to exclude child classes as well, but it seems based on the comment in the issue (https://github.com/dotnet/roslyn-analyzers/issues/7268#issuecomment-2021040159) that this could lead to false negatives.
Based on that comment I would say no, but as the Stream
or MemoryStream
are not sealed we might want to make it configurable: https://github.com/dotnet/roslyn-analyzers/blob/main/docs/Analyzer%20Configuration.md#excluded-symbols what you think @mpidash @stephentoub?
Let me know if we want to exclude child classes as well, but it seems based on the comment in the issue (#7268 (comment)) that this could lead to false negatives.
Based on that comment I would say no, but as the
Stream
orMemoryStream
are not sealed we might want to make it configurable: https://github.com/dotnet/roslyn-analyzers/blob/main/docs/Analyzer%20Configuration.md#excluded-symbols what you think @mpidash @stephentoub?
We could, but I'd be fine waiting until we have real user cases for it. MemoryStream is one that comes up a lot, especially in tests, and so it's worth reducing noise about.
Good point, thanks!
Fixes #7268.
I only excluded exact type matches of known reliable stream types (i.e. instances of
System.IO.MemoryStream
orSystem.IO.UnmanagedMemoryStream
). Let me know if we want to exclude child classes as well, but it seems based on the comment in the issue (https://github.com/dotnet/roslyn-analyzers/issues/7268#issuecomment-2021040159) that this could lead to false negatives.We could detect more cases with flow analysis, but this would mean that the rule is disabled by default (AFAIK).
cc @buyaa-n @stephentoub