Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix S3242: Rule should not suggest base type resulting in inconsistent accessibility (bis) #1610

Closed
antoinebj opened this issue Aug 2, 2018 · 0 comments
Assignees
Labels
Type: False Positive Rule IS triggered when it shouldn't be.
Milestone

Comments

@antoinebj
Copy link

antoinebj commented Aug 2, 2018

Description

This is similar to #863, for which the fix apparently did not cover all situations.

Repro steps

  1. Create a solution with 2 projects

  2. In one project, add the following code:

internal interface IFoo
{
    bool IsFoo { get; }
}

public class Foo : IFoo
{
    public bool IsFoo { get; set; }
}
  1. In the other project, reference the project that defines Foo, and add the following code:
internal class Bar
{
    public void MethodOne(Foo foo)
    {
        var x = foo.IsFoo;
    }
}

Expected behavior

A violation of S3242 should not be raised, because IFoo is not accessible from the project defining Bar.

Actual behavior

A violation of S3242 is raised.
Note: If the Bar class is made public, that does not happen.

Related information

  • SonarC# Version 7.3
  • Visual Studio Version 15.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: False Positive Rule IS triggered when it shouldn't be.
Projects
None yet
Development

No branches or pull requests

3 participants