Description
Analyzer
Diagnostic ID: CA1002: Do not expose generic lists
Analyzer source
NuGet Package: Microsoft.CodeAnalysis.NetAnalyzers
Version: 7.0.0
Describe the bug
This rule prevents the use of Generic Lists for inheritance issues, however sealed classes cannot be inherited, so the rule should not apply. I suggest creating an exception for sealed classes.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/sealed
Steps To Reproduce
- Create a 'sealed' class.
- Create a property of type Generic List.
- Observe the analyzer give error CA1002.
Expected behavior
Analyzer should not cite CA1002 on sealed classes.
Actual behavior
Analyzer cites CA1002 on sealed classes.
Additional context
None
Activity