Blogs - get by archive breaking

Topics: Core, Customizing Orchard
Aug 20, 2013 at 9:54 AM
Hi There

I have a blog archives widget and when I click on a month to show blogs in that month I am getting an error. This was working at one point and I am not sure when it stopped working and what is the cause.

Could somebody please let me know where I can start looking or debugging to get to the bottom of this. I am not even sure where to start.

Please see trace below

2013-08-20 11:47:34,063 [51] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caught
System.NullReferenceException: Object reference not set to an instance of an object.
at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints) in c:\Projects\Toyota2013\Toyota-Website\toyota-website\Code\src\Orchard\ContentManagement\DefaultContentManager.cs:line 207
at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options) in c:\Projects\Toyota2013\Toyota-Website\toyota-website\Code\src\Orchard\ContentManagement\DefaultContentManager.cs:line 119
at Orchard.ContentManagement.DefaultContentQuery.<Slice>b__2(ContentItemVersionRecord x) in c:\Projects\Toyota2013\Toyota-Website\toyota-website\Code\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 164
at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext()
at System.Collections.Generic.List
1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
at Orchard.Utility.Extensions.ReadOnlyCollectionExtensions.ToReadOnlyCollection[T](IEnumerable1 enumerable) in c:\Projects\Toyota2013\Toyota-Website\toyota-website\Code\src\Orchard\Utility\Extensions\ReadOnlyCollectionExtensions.cs:line 8
at Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count) in c:\Projects\Toyota2013\Toyota-Website\toyota-website\Code\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 162
at Orchard.ContentManagement.DefaultContentQuery.ContentQuery
1.Orchard.ContentManagement.IContentQuery<T>.List() in c:\Projects\Toyota2013\Toyota-Website\toyota-website\Code\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 212
at Orchard.Blogs.Services.BlogService.Get(String path)
at Orchard.Blogs.Controllers.BlogPostController.ListByArchive(String path)
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func
1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
Aug 21, 2013 at 12:20 PM
Fixed found a ContentItem Record that was not linked to a ContentType.

I removed this record from the contentitem table as well as the version table.

Everything worked again.