ProjectionPart fails to load with an error NullReferenceException thrown from IContentPartDriver by Orchard.Projections.Drivers.ProjectionPartDriver

Topics: Core, Troubleshooting
Aug 19, 2013 at 1:39 PM
Hi all,

I've been trying to resolve this for days, debugging and disabling a lot of things but can't seem to understand what's going on. Basically, my Projection page (both create and edit) fails to load the ProjectionPart. After looking at the error log, I could see the following error message:
2013-08-19 21:15:02,503 [10] Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator - NullReferenceException thrown from IContentPartDriver by Orchard.Projections.Drivers.ProjectionPartDriver
System.NullReferenceException: Object reference not set to an instance of an object.
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options, QueryHints hints) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\ContentManagement\DefaultContentManager.cs:line 218
   at Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\ContentManagement\DefaultContentManager.cs:line 130
   at Orchard.ContentManagement.DefaultContentQuery.<Slice>b__2(ContentItemVersionRecord x) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 164
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Orchard.Utility.Extensions.ReadOnlyCollectionExtensions.ToReadOnlyCollection[T](IEnumerable`1 enumerable) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\Utility\Extensions\ReadOnlyCollectionExtensions.cs:line 8
   at Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 162
   at Orchard.ContentManagement.DefaultContentQuery.ContentQuery`1.Orchard.ContentManagement.IContentQuery<T>.List() in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 212
   at Orchard.Projections.Drivers.ProjectionPartDriver.<>c__DisplayClass47.<Editor>b__43()
   at Orchard.ContentManagement.Drivers.ContentPartDriver`1.<>c__DisplayClassf.<ContentShape>b__e(BuildShapeContext ctx) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\ContentManagement\Drivers\ContentPartDriver.cs:line 130
   at Orchard.ContentManagement.Drivers.ContentPartDriver`1.<>c__DisplayClass15.<ContentShapeImplementation>b__14(BuildShapeContext ctx) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\ContentManagement\Drivers\ContentPartDriver.cs:line 139
   at Orchard.ContentManagement.Drivers.ContentShapeResult.ApplyImplementation(BuildShapeContext context, String displayType) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\ContentManagement\Drivers\ContentShapeResult.cs:line 39
   at Orchard.ContentManagement.Drivers.ContentShapeResult.Apply(BuildEditorContext context) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\ContentManagement\Drivers\ContentShapeResult.cs:line 25
   at Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator.<>c__DisplayClassd.<BuildEditor>b__c(IContentPartDriver driver) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\ContentManagement\Drivers\Coordinators\ContentPartDriverCoordinator.cs:line 57
   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in d:\projects\OrchardProject Project\OrchardProject\src\Orchard\InvokeExtensions.cs:line 17 
I've wasted a lot of hrs trying to troubleshoot this, but can't seem to understand what is going on under the hood. Looks like some problem with Queries and/or ContentItemVersion. Has anyone seen this issue or know what might be the issue? I would appreciate any help to troubleshoot this issue.

Btw, I have only started to notice this issue after upgrading to the latest.


Thanks.
Coordinator
Aug 22, 2013 at 5:28 AM
Attach a debugger and break on those exceptions. You should be able to figure out what's failing.