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

CA1508 should not warn on as expression #4411

Closed
JohanLarsson opened this issue Nov 5, 2020 · 0 comments · Fixed by #4358
Closed

CA1508 should not warn on as expression #4411

JohanLarsson opened this issue Nov 5, 2020 · 0 comments · Fixed by #4358
Labels
False_Positive A diagnostic is reported for non-problematic case

Comments

@JohanLarsson
Copy link

class A
{
    void M(object o)
    {
        if (o is A a)
        {
        //  ↓↓↓↓↓ CA1508
            (a as B)?.ToString();
        }
    }
}

class B : A
{
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False_Positive A diagnostic is reported for non-problematic case
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants