Try our conversational search powered by Generative AI!

Possible bug with EPiServer.Blog

Vote:
 

We are using EPiServer.Blog and have encountered a problem when republishing the root page; an exception is thrown:

[ArgumentNullException: Parameter has no page set
Parameter name: pageLink]
   EPiServer.DataFactory.GetPage(PageReference pageLink, ILanguageSelector selector) +290
   EPiServer.Blog.EventHandlers.PublishingPage(Object sender, PageEventArgs e) +129
   EPiServer.PageEventHandler.Invoke(Object sender, PageEventArgs e) +0
   EPiServer.Core.PageStoreBase.RaiseCancellablePageEvent(Object key, String defaultReason, PageEventArgs eventArgs) +74
   EPiServer.DataFactory.Save(PageData page, SaveAction action, AccessLevel access) +295

 

This is cause by EPiServer.Blog.EventHandlers.PublishingPage(object sender, PageEventArgs e)

private void PublishingPage(object sender, PageEventArgs e)
{
    if (((!this.IsImport() 
	    && (e.Page != null)) 
	    && (e.Page.IsMasterLanguageBranch 
	    && (BlogFactory.DataFactory.GetPage(e.Page.ParentLink)["BlogStart"] != null))) 
	    && string.Equals(e.Page.PageTypeName, Configuration.ItemPageTypeName, StringComparison.OrdinalIgnoreCase))
    {
        ...

When republishing the root page "BlogFactory.DataFactory.GetPage(e.Page.ParentLink)" will throw an exception as root page has no parent. Can you confirm if this is a bug?

 

#56226
Jan 12, 2012 15:36
Vote:
 

Yes it appears so. The event will fire for every page publish, including the root page.

As you stated, the root page will never have a parent, so e.Page.ParentLink will be null. Hence the ArgumentNullException thrown by the GetPage method.

I would copy all the code from EPiServer.Blog.EventHandlers into another module, and register that in web.config instead. You can then amend the code within the PublishingPage method to perform a check to ascertain whether it is the root page.

#56294
Jan 17, 2012 0:04
Vote:
 

This issue has been added as bug 75945

While waiting for the next (fixed) release, your advice, Tom, should work nicely :)

#56364
Edited, Jan 19, 2012 12:29
Vote:
 

Thanks Tom, your answer helped me

#60207
Jul 25, 2012 16:55
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.