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

Warning reported for assignment to property marked [AllowNull] #39926

Closed
cston opened this issue Nov 21, 2019 · 0 comments · Fixed by #39939
Closed

Warning reported for assignment to property marked [AllowNull] #39926

cston opened this issue Nov 21, 2019 · 0 comments · Fixed by #39939
Assignees
Milestone

Comments

@cston
Copy link
Member

cston commented Nov 21, 2019

No warnings should be reported:

#nullable enable

using System.Diagnostics.CodeAnalysis;

class C<T>
{
    [MaybeNull, AllowNull]
    T F = default;
    [MaybeNull, AllowNull]
    T P { get; } = default; // warning CS8601: Possible null reference assignment

    C([AllowNull]T t)
    {
        F = t;
        P = t; // warning CS8601: Possible null reference assignment
    }
}

See also #39922.

@cston cston self-assigned this Nov 21, 2019
@cston cston added this to the 16.5 milestone Nov 21, 2019
@cston cston changed the title Warning reported for assignment to field or property marked [MaybeNull] Warning reported for assignment to property marked [AllowNull] Nov 21, 2019
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.

1 participant