dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.21k stars 5.86k forks source link

The examples do not trigger CA2000 #25722

Open eatdrinksleepcode opened 3 years ago

eatdrinksleepcode commented 3 years ago

Neither of the examples on this page trigger CA2000 when using the Roslyn analyzers built into the project SDK. I am able to trigger CA2000 on other code in the same project (e.g. by not disposing a SqlConnection), but not from these examples. I initially thought that only the second example was a problem, because it uses a local StreamReader, even though the "Special Cases" section says that TextReader is excluded. However, the first example does not trigger CA2000 either.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

eatdrinksleepcode commented 3 years ago

See here for the repro: https://github.com/eatdrinksleepcode/ca-troubleshooting/commit/b525fd2b52e6e2b29886b6523e55d96111688a55