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

Should not report warning for second dereference of nullable value #26749

Closed
cston opened this issue May 9, 2018 · 2 comments
Closed

Should not report warning for second dereference of nullable value #26749

cston opened this issue May 9, 2018 · 2 comments
Milestone

Comments

@cston
Copy link
Member

cston commented May 9, 2018

The second warning is redundant and incorrect:

class Program
{
    static void F(string? s)
    {
        int n = s.Length; // warning: 's' may be null
        if (s.Length > 0) // warning: 's' may be null
        {
        }
    }
}
(5,17): warning CS8602: Possible dereference of a null reference.
(6,13): warning CS8602: Possible dereference of a null reference.
@cston
Copy link
Member Author

cston commented May 9, 2018

cc @jcouv

@jcouv
Copy link
Member

jcouv commented Jul 26, 2018

Dupe of #23270

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