vendredi 2 septembre 2016

StackOverflow exception for siblings in Umbraco 7.5.2

I have the following structure in Content page

Index
   |__ Blog 1
   |__ Blog 2
   |__ Blog 3
Shared
   |__ Footer
   |__ Icons

In my model which is derived from RenderModel, I have the following code which retrieves footer info from Shared node:

IPublishedContent index = Content.AncestorOrSelf(1); // it gives me Index

IPublishedContent shared = index.FollowingSibling("shared") ??
                           index.PrecedingSibling("shared"); // I don't base on Shared position because it might be after or before Index so I would use ?? operator

IPublishedContent footer = shared?.Descendant("footer");

The problem is that shared variable throws System.StackOverflowException

Why ? Where is my mistake ?

I tried also only:

IPublishedContent shared = index.FollowingSibling("shared") ;

same thing, same exception !

Aucun commentaire:

Enregistrer un commentaire