https://discord.umbraco.com logo
#package-development
Title
# package-development
j

Jason

05/16/2022, 10:16 AM
Updating my package for v10. Is it weird that the extensions provided by UmbracoBuilderExtensions are all nullable by default? e.g.
Copy code
csharp
builder.PropertyValueConverters()?.Append<MyClass>();
My package assumes that the
IUmbracoBuilder.PropertyValueConverterCollectionBuilder
exists (why wouldn't it?). I don't want to make everything nullable as, in this case, if
IUmbracoBuilder.PropertyValueConverterCollectionBuilder
is null then something bad has happened and my package won't work... so at the moment I have this:
Copy code
csharp
var collectionBuilder = builder.PropertyValueConverters();
if (collectionBuilder is null)
{
  throw new NullReferenceException("The IUmbracoBuilder must have a PropertyValueConverterCollectionBuilder");
}
My question is: Should it really be my package's responsibility to handle cases where PropertyValueConverterCollectionBuilder is null? (fine if it is, but it seems like this is something pretty core to Umbraco, and should really be guaranteed to exist in the APIs that I'm using).