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

RCS1146 (Use conditional access) is truncating bool property names #47

Closed
NickCraver opened this issue Feb 18, 2017 · 1 comment
Closed

Comments

@NickCraver
Copy link
Member

Best explained in a picture:

screen shot 2017-02-18 at 10 58 11

This only happens if there's trailing boolean logic afterwards. Here's a minimal repro:

public class A
{
    public bool Prop { get; }
    public static GetProp(A obj)
    {
        if (obj != null && obj.Prop && true)
        {
            Console.WriteLine("Hey!");
        }
    }
}

Currently, RCS1146 refactors this to:

        if (obj?.Pro == true && true)
        {
            Console.WriteLine("Hey!");
        }

Relevant code link: UseConditionalAccessRefactoring.cs#L139

@josefpihrt
Copy link
Collaborator

This has been fixed in #42.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants