This project is read-only.


BlogPostPartHandler NullReferenceException


Happens in 1.7.1 for each request in admin zone.

     if (blogPost == null)
blogPost is not null
 context.Metadata.CreateRouteValues = new RouteValueDictionary {
                {"Area", "Orchard.Blogs"},
                {"Controller", "BlogPostAdmin"},
                {"Action", "Create"},
                {"blogId", blogPost.BlogPart.Id}
blogPost.BlogPart is null

blogPost.ContentItem.Id = 0
Closed Sep 11, 2014 at 8:44 PM by sebastienros


sebastienros wrote Feb 4, 2014 at 8:54 PM

Can you please provide a repro to get in that state ?

x0r wrote Feb 5, 2014 at 10:39 AM

I tried to look for any specifics to my project and i tracked this issue to a point where the admin menu is built, context.ContentItem.As<BlogPostPart>() is not null, yet its Id==0.

Now I figured that it is coming from menu New -> Blog Post. I changed the Blog Post Content type not to be Creatable and the issue is gone.

The reason I made it createable is i utilize the Content Picker Field for selecting related blogposts and other content types. When i started to use that field, it wasn't possible filter it to a not-creatable ContentType - unlike now and i forgot to make it non-creatable again...

Sorry for the inconvenience Sebastien...