umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.42k stars 2.67k forks source link

Inconsistent nullability (MayBeNull) when using compositions with modelsbuilder in v9 #11118

Closed JasonElkin closed 2 years ago

JasonElkin commented 3 years ago

Which exact Umbraco version are you using? For example: 8.13.1 - don't just write v8

9.0.0-rc003

Bug summary

When using Nullable Reference Types in v9 the System.Diagnostics.CodeAnalysis.MaybeNull attribute seems to be inconsistently applied. It exists on the composition but not the content model itself i.e.

image

Specifics

Here's the generated IPageHeader image

Here's the actual property on the doctype: image

Steps to reproduce

  1. Configure ModelsBuilder to use SourceCodeAuto or SourceCodeManual
  2. Create a Composition with a nullable property value.
  3. Apply composition to another content type.
  4. Generate ModelsBuilder models.

Expected result / actual result

Properties on composed content types would have the same MayBeNull attribute as the compositions they implement.

umbrabot commented 3 years ago

Hi @JasonElkin,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post

Thanks muchly, from your friendly Umbraco GitHub bot :-)