Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ryan 4 posts 24 karma points
    Mar 16, 2011 @ 23:15
    Ryan
    0

    remove at event errors

    I'm trying to write a News application with automatic archiving.  My code is very similar to the solution detailed at http://deeper.webangelo.net/2010/4/9/blog4umbraco-post-date.aspx , except I'm using the AfterUnPublish event.  Everything works fine when I manually unpublish the node, but I'm getting errors when I use the "Remove At" date to unpublish the node.

    I've done some debugging and it seems that the errors are being caused when it hits the library.UpdateDocumentCache() and new Node() methods.

    This is the stack trace from hitting library.UpdateDocumentCache() :

    Error publishing node: System.NullReferenceException: Object reference not set to an instance of an object.
    at umbraco.presentation.UmbracoContext.get_Current()
    at umbraco.library.GetXmlNodeById(String id)
    at UmbracoExamine.ContentExtensions.ToXDocument(Content node, Boolean cacheOnly)
    at UmbracoExamine.UmbracoEventManager.content_AfterUpdateDocumentCache(Document sender, DocumentCacheEventArgs e)
    at umbraco.content.DocumentCacheEventHandler.Invoke(Document sender, DocumentCacheEventArgs e)
    at umbraco.content.FireAfterUpdateDocumentCache(Document sender, DocumentCacheEventArgs e)
    at umbraco.content.UpdateDocumentCache(Document d)
    at umbraco.content.UpdateDocumentCache(Int32 pageId)
    at umbraco.library.UpdateDocumentCache(Int32 DocumentId)
    at umbraco.presentation.publishingService.CheckPublishing(Object sender)

     

    I'm running 4.7 now, but I had the same problem in 4.6.1.

    What's different about "Remove At" that could be causing these errors?

    Thanks

  • Elwyn 8 posts 28 karma points
    Mar 31, 2011 @ 22:40
    Elwyn
    0

    I get this issue also.

     

    void Document_AfterPublish(Document sender, PublishEventArgs e)
    {
    var rootNode = umbraco.library.GetXmlNodeById(ROOT_NODE_ID.ToString());

     

     

    This breaks on GetXmlNodeById. I am sure the ID I am supplying is correct - this works perfectly when I publish the node manually, however when I use the Publish At feature, it throws a NullReferenceError 

    Edit: That's on 4.6.1 btw

Please Sign in or register to post replies

Write your reply to:

Draft