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.
Hi, Ever found the issue with this? I'm running into an issue where tthe nested content value is throwing a nullreference error whe I try and access it from the indexvaluestranforming event of examine index
Hi Gabor, not searched for or found the solution, but there's is a workaround that helpes to bypass this error:
try adding a second (dummy)element to your nested content type. At some point this was a remedy to this exact error.
Using ModelsBuilder also seems to do the trick, but upgrading older projects to use it, is not always the most efficient solution.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted