I am trying to access children property in my Glass Model type.

public partial class Section : GlassBase
    public virtual IEnumerable<Section_Link> Children { get; set; }

But it is throwing stackoverflow exception when I try to access the children

if (section.Children.Any())

Later I tried using the Sitecore API's as well

    var sectionTest = Sitecore.Context
        .Database.GetItem(new ID("{AC29FD56-28F4-434A-B1E2-36BA9BE7A84F}"));
    if (sectionTest.HasChildren)

It also resulted in the same error.

Exception: An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

Section_Link is a normal Glass model class

Can someone help me with if I am doing something wrong here

Error Screenshot

  • 1
    Hi there, can you please provide version of Glass Mapper and Sitecore that you are using? – Pete Navarra Feb 13 '17 at 3:59
  • Hi, I am using Sitecore 8.2 and Glass Mapper 4.3.4 versions – Meghan Feb 13 '17 at 5:29
  • 1
    @Meghan Please edit your question to include the full stack trace of the exception. – Dmytro Shevchenko Feb 13 '17 at 6:30
  • @Meghan please post exception from sitecore log – Andrey Bobrov Feb 13 '17 at 8:02
  • 2
    The fact that this is happening with the bare Sitecore APIs tells me this is probably an issue in custom code somewhere. The fact that it happens during the 'GetChildren' call tells me you probably have a circular recursive lookup going on when resolving children or items. I would recommend removing all custom pipeline code, and seeing if that fixes things. If so, I would then add back each piece of custom code one by one, until the problem recurs. The one that causes the issue is your culprit. – Chris Smith Feb 13 '17 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.