You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using nullable reference types on a Pulumi IaC project where I use the builder pattern. But find it difficult to get dotnet to figure out when items are not null.
The Builder Pattern is a delayed constructor.
The things it is supposed to build will be null until the Build() method has been executed.
But after Build they won't be null.
I try to help by using MemberNotNull attributes but that seems to just kick the can down the road only level.
The text was updated successfully, but these errors were encountered:
Adding the <Nullable>enable</Nullable> is what is needed but there is a lot of warnings of course.
Those errors can be removed by giving the different instances "default" values. But I think it's not very good practice doing so.
The question is also what would a "default" value be for example for a Customer object. And if we create two default Customer objects, are they considered equal or not because the have the same values or are they only equal if they have the same reference.
But if someone want's to play with nullable references you can just add <Nullable>enable</Nullable> in BuilderTestSample.csproj under the first <PropertyGroup> and build it.
Not sure this is worth it adding in the main repository.
I am using nullable reference types on a Pulumi IaC project where I use the builder pattern. But find it difficult to get dotnet to figure out when items are not null.
The Builder Pattern is a delayed constructor.
The things it is supposed to build will be null until the
Build()
method has been executed.But after
Build
they won't be null.I try to help by using
MemberNotNull
attributes but that seems to just kick the can down the road only level.The text was updated successfully, but these errors were encountered: