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

CS8669 warning for types with nullable properties #46

Open
j-mok opened this issue Jul 11, 2024 · 0 comments
Open

CS8669 warning for types with nullable properties #46

j-mok opened this issue Jul 11, 2024 · 0 comments

Comments

@j-mok
Copy link

j-mok commented Jul 11, 2024

I've got a .NET 8/C# 12 project with nullable references enabled and when I use BuilderGenerator on a class that has properties with nullable reference types, the generated builder becomes a source of compiler warnings:

FooDtoBuilder.g.cs(102,77): Warning CS8669 : The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.

This seems to be a consequence of a combination of #nullable disable in the generated code and the keeping the ? suffix on data fields:

public System.Lazy<string?> BazProperty = new System.Lazy<string?>(() => default(string?));

Can this be fixed somehow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant