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
A public class which is used as parameter type for a public member in another class gets triggered with CA1515.
Steps To Reproduce
Create a public class:
public class Class1 // <- CA1515
{
}
Create another class which uses Class1 as parameter type for its public member:
public class Class2
{
public Class2(Class1 class1)
{
}
}
Expected behavior
No CA1515 issue reported.
Actual behavior
Issue reported: 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)
If I made Class1internal instead like CA1515 suggests, I get the following build error: CS0051: Inconsistent accessibility: parameter type 'Class1' is less accessible than method 'Class2.Class2(Class1)'
Additional context
The text was updated successfully, but these errors were encountered:
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.101
OR
NuGet Package: Microsoft.CodeAnalysis.NetAnalyzers
Version: 9.0.0
Describe the bug
A
public
class which is used as parameter type for a public member in another class gets triggered with CA1515.Steps To Reproduce
public
class:Class1
as parameter type for its public member:Expected behavior
No CA1515 issue reported.
Actual behavior
Issue reported:
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)
If I made
Class1
internal
instead like CA1515 suggests, I get the following build error:CS0051: Inconsistent accessibility: parameter type 'Class1' is less accessible than method 'Class2.Class2(Class1)'
Additional context
The text was updated successfully, but these errors were encountered: