Copied to clipboard

Flag this post as spam?

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


This forum does not allow new topics to be created, please use the v2 forum from now on.

  • Jeff Grine 149 posts 189 karma points
    Sep 27, 2010 @ 15:12
    Jeff Grine
    0

    Object reference not set - Document_BeforePublish

    Running 4.5.2 on .Net 3.5, I'm getting the error below only when using the scheduled publishing (Publish At on the properties tab):

    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 umbraco.presentation.nodeFactory.Node..ctor(Int32 NodeId)     
        at InfoCaster.Umbraco._301UrlTracker.Base301URLTracker.Document_BeforePublish(Document doc, PublishEventArgs e)     
        at umbraco.cms.businesslogic.web.Document.PublishEventHandler.Invoke(Document sender, PublishEventArgs e)     
        at umbraco.cms.businesslogic.web.Document.FireBeforePublish(PublishEventArgs e)     
        at umbraco.cms.businesslogic.web.Document.PublishWithResult(User u)     
        at umbraco.cms.businesslogic.web.Document.Publish(User u)     
        at umbraco.presentation.publishingService.CheckPublishing(Object sender)
    
    It looks like it's trying to access the node in the xml before it's been published? Not sure why it would only do this when publishing on a schedule?
  • Stefan Kip 1606 posts 4098 karma points c-trib
    Sep 27, 2010 @ 15:47
    Stefan Kip
    0

    Well, I'm trying to access the previous version of the document/node by accessing the current node (before publish, so it's the old version).
    This ofcourse should be contained in a try/catch block, because a node could not exist...
    I'm doing this to detect changes in the node's name btw.

    I added a try/catch block and built a new DLL, which you can get here: http://jump.fm/YSQSV --> click on the small text link "Save file to your PC: click here" on the bottom.
    Just replace the existing assembly in de \bin folder with this one!

  • Jeff Grine 149 posts 189 karma points
    Sep 27, 2010 @ 15:50
    Jeff Grine
    0

    Wow, thanks for the quick work. You might consider checking Document.IsPublished instead of the try/catch, just to save some of the exception handling?

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Sep 27, 2010 @ 15:56
    Stefan Kip
    0

    No thanks, that way I need to access the DB, which is slow ;-) I'd like not to slow thing down :-) Let me know if it helps!

  • Jeff Grine 149 posts 189 karma points
    Sep 27, 2010 @ 17:49
    Jeff Grine
    0

    Looks like that did the trick, thanks.

    Exception handling would definitely be faster than that trip to the db. I was assuming you could check the property on the Document that is passed into the handler and avoid that.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Sep 27, 2010 @ 19:20
    Stefan Kip
    0

    Nice :-)

    Well, you're right about the document parameter, but I'm not sure if that's the 'old' unpublished version or the 'new' published version (I think I can remember that 'before_' doesn't contain the old version of the document.

    Anyway, it works this way ;-) I'll include it in the next version of the 301 URL Tracker, hopefully I'll be able to get on with it in October...

  • Janet Kirklen 102 posts 212 karma points
    Feb 16, 2011 @ 17:49
    Janet Kirklen
    0

    I am having this same issue and getting the same error in the audit log for any page that we schedule to publish.  The link Jeff Grine supplied above is no longer a valid link.  Is there a fix for this available?  I am also running umbraco v 4.5.2 (Assembly version: 1.0.3891.20719) with .Net 3.5.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Feb 16, 2011 @ 17:52
    Stefan Kip
    0

    Which version of the 301 URL Tracker are you using?

  • Janet Kirklen 102 posts 212 karma points
    Feb 16, 2011 @ 18:14
    Janet Kirklen
    0

    I am not award that I am using a 301 URL Tracker.  Is this something that is part of the Umbraco base install?  If so, where to I look to find out what version is there.  If it's an add-on package is this something I need for auto publishing to work?

    I've also discovered that the Remove File feature does not seem to be working.   I don't get an error, just nothing seems to happen.  I was assuming that this feature would unpublish the page at the sepcified time.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Feb 16, 2011 @ 18:23
    Stefan Kip
    0

    Well this topic is created for the 301 URL Tracker. If you're experiencing errors with 'just umbraco' please post your questions here:
    http://our.umbraco.org/forum/getting-started/installing-umbraco

  • Janet Kirklen 102 posts 212 karma points
    Feb 16, 2011 @ 19:59
    Janet Kirklen
    0

    Sorry about that.  In a search for the error I am getting it matched on this thread. The description of the problem is the same i'm seeing.  The quick reply was nice!  :)

    I've moved this question: http://our.umbraco.org/forum/getting-started/installing-umbraco/17433-Error-in-Audit-Trail-on-scheduled-publishing

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies