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
NullReferenceException caused when attempting to use nested content. This pattern is showing up in many places on my application. How is it possible to pass HasValue check but still throw NullReferenceException on attempt to access?
What Umbraco version are you using?
Are you sure that data is presented in the property?
Thanks for your help. Umbraco 8.0.1. I am sure that the content is in and published in the nested content field.
Can you show more of your view? It's possible the error is lying to you about which line the issue is actually on :-)
I'm having this same exact issue. Has anyone found any reasons why this is happening.
I have checked my nested property to make sure all properties of the
element are filled in.
var socialAccounts = Model.Value<IEnumerable<IPublishedElement>>("social");
<!-- Social -->
@foreach (var item in socialAccounts)
var url = item.Value<String>("accountUrl");
var title = item.Value<String>("SocialAccount");
<a href='@url' title='@title'><i class='fa @item.Value("socialIcon")'></i></a>
Update (over 24 hours later):
I deleted and rebuilt the nested datatype and the element and I STILL have a null reference.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted