You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error reported: Class1.cs(3,26): error CA1515: Because an application's API isn't typically referenced from outside the assembly, types can be made internal (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1515)
Additional context
The text was updated successfully, but these errors were encountered:
This false positive seems to happen for any public nested type of an otherwise internal type. The analyzer SHOULD be checking if the target type is "effectively public" rather than marked public.
I did create a merge request that checks if the type/delegate/enum is externally accessible instead of public.
However, from reading through the docs it isn't quite clear whether this is intended but some of the tests for this functionality imply that it is intended...
Analyzer
Diagnostic ID: CA1515:
Consider making public types internal
Analyzer source
SDK: Built-in CA analyzers in .NET 9 SDK or later
Version: SDK 9.0.100-rc.2.24474.11
OR
NuGet Package: Microsoft.CodeAnalysis.NetAnalyzers
Version: 9.0.0-preview.24454.1
Describe the bug
A
public delegate
is defined within aninternal class
. CA1859 is generated for the delegate.Steps To Reproduce
Expected behavior
No errors reported
Actual behavior
Error reported:
Class1.cs(3,26): error CA1515: Because an application's API isn't typically referenced from outside the assembly, types can be made internal (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1515)
Additional context
The text was updated successfully, but these errors were encountered: