Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm using ModelsBuilder in SourceCodeAuto mode, and I have a CMS property called pageHeading. (Umbraco V10.0.1)
When I render pageHeading in my View all is good, until I clear the value of pageHeading in the CMS (ie. leave the field blank and publish). When I do that the GetPageHeading property in the auto-generated model throws a NullReferenceException when I call @Model.PageHeading in the View. So far I've noticed this problem with TextString and RTE fields.
I don't think I'm doing anything out of the ordinary and I haven't encountered this in previous versions of Umbraco. I've tried switching on/off nullable reference types for the project, to no avail.
Does anyone have any ideas as to what's causing this?
The issue was being caused by me overriding the constructor that's generated by modelsbuilder. I wasn't setting the local _publishedValueFallback field value, like the generated constructor was, so no fallback when the CMS field was left blank.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted