This project is read-only.

NullReferenceException caused by TermPart.As<AutoroutePart>() = null

Topics: Core, General, Troubleshooting
Dec 18, 2013 at 8:08 AM
Edited Dec 18, 2013 at 8:27 AM

I'm on Orchard 1.7.2 and I get this error everywhere in my site (which I assume causes the load times to slow down):
Orchard.DisplayManagement.Implementation.DefaultDisplayManager - NullReferenceException thrown from Action`1 by System.Action`1[[Orchard.DisplayManagement.Implementation.ShapeDisplayingContext, Orchard.Framework, Version=, Culture=neutral, PublicKeyToken=null]]
System.NullReferenceException: Object reference not set to an instance of an object.
So I traced the issue and found the function public string Slug within TermPart.cs (line 16).
       public string Slug {
            get { return this.As<AutoroutePart>().DisplayAlias; }
            set { this.As<AutoroutePart>().DisplayAlias = value; }
I found out that this.As<AutoroutePart>() is null, and checking out the parts of the Content Item (via, there is no AutoroutePart. Since it is null, a null reference exception is thrown when trying to retrieve the property DisplayAlias.

See image below:


Is this a known issue? Any workarounds? Is this what's causing my site to slow down?
Dec 18, 2013 at 3:45 PM
Replied there (BTW nice detailed question!).