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

Nullable field warnings are missing when using struct primary constructors #74726

Closed
RikkiGibson opened this issue Aug 12, 2024 · 0 comments · Fixed by #74844
Closed

Nullable field warnings are missing when using struct primary constructors #74726

RikkiGibson opened this issue Aug 12, 2024 · 0 comments · Fixed by #74844

Comments

@RikkiGibson
Copy link
Contributor

SharpLab

public struct StructTest() // no warning
{
    public string Text { get; set; }
}

public struct StructTest2
{
    public string Text { get; set; }
    public StructTest2() { } // warning CS8618: Non-nullable property 'Text' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
}
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 12, 2024
@jaredpar jaredpar added this to the 17.13 milestone Aug 20, 2024
@jaredpar jaredpar modified the milestones: 17.13, 17.12 Aug 20, 2024
@jaredpar jaredpar removed the untriaged Issues and PRs which have not yet been triaged by a lead label Aug 20, 2024
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