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

CA1062 stumbles when pattern-matching with [] #6755

Closed
RenderMichael opened this issue Jul 10, 2023 · 2 comments · Fixed by #6877
Closed

CA1062 stumbles when pattern-matching with [] #6755

RenderMichael opened this issue Jul 10, 2023 · 2 comments · Fixed by #6877
Assignees
Labels
Bug The product is not behaving according to its current intended design DataFlow False_Positive A diagnostic is reported for non-problematic case
Milestone

Comments

@RenderMichael
Copy link
Contributor

Version Used: .NET 7

Steps to Reproduce:

string? M(string[]? obj)
{
    if (obj is null or [])
    {
        return null;
    }
    return obj.ToString(); // error diagnosed here
}
@Youssef1313
Copy link
Member

This belongs to dotnet/roslyn-analyzers

@RenderMichael
Copy link
Contributor Author

This belongs to dotnet/roslyn-analyzers

@Youssef1313 Sorry! Could someone move this issue over or should I log a new one there?

@jcouv jcouv transferred this issue from dotnet/roslyn Jul 11, 2023
@mavasani mavasani added Bug The product is not behaving according to its current intended design Area-Microsoft.CodeQuality.Analyzers DataFlow False_Positive A diagnostic is reported for non-problematic case labels Jul 14, 2023
@mavasani mavasani added this to the Unknown milestone Jul 14, 2023
@mavasani mavasani self-assigned this Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The product is not behaving according to its current intended design DataFlow 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