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

RCS1096 does not work correctly with composite flags #1555

Closed
Genbox opened this issue Oct 9, 2024 · 0 comments · Fixed by #1558
Closed

RCS1096 does not work correctly with composite flags #1555

Genbox opened this issue Oct 9, 2024 · 0 comments · Fixed by #1558
Assignees

Comments

@Genbox
Copy link

Genbox commented Oct 9, 2024

This seems to have been reported before, but it is still not working correctly.

Repo:

internal class Program
{
    private static FileAttributes _skipMask = FileAttributes.Device | FileAttributes.Offline;

    internal static void Main()
    {
        var fileAttr = FileAttributes.Device;

        //RCS1096 is reported here
        if ((fileAttr & _skipMask) != 0)
            Console.WriteLine("AndCheck: Flags were present");
        else
            Console.WriteLine("AndCheck: Flags not present");

        if (fileAttr.HasFlag(_skipMask))
            Console.WriteLine("HasFlag: Flags were present");
        else
            Console.WriteLine("HasFlag: Flags not present");
    }
}

Output:

AndCheck: Flags were present
HasFlag: Flags not present
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants