Copied to clipboard

Flag this post as spam?

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

  • Drew 165 posts 340 karma points
    Oct 31, 2011 @ 13:18

    Bug 1.1.3 - breaks 'Publish At' feature in Umbraco

    On both 4.7 and 4.7.1 when using Embedded Content on a document type such as a page, if you set a "publish at" date time - it doesn't work.

    Pages published fine manually.

    The error logged is:

    Error publishing node: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.     at TheFarm.Umbraco.EmbeddedContent.DataEditor.Initialize()     at TheFarm.Umbraco.EmbeddedContent.DataEditor..ctor()     --- End of inner exception stack trace ---     at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)     at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)     at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)     at System.Activator.CreateInstance(Type type, Boolean nonPublic)     at umbraco.cms.businesslogic.datatype.controls.Factory.GetNewObject(Guid DataEditorId)     at pt, Content c, Guid versionId)     at umbraco.cms.businesslogic.Content.createNewVersion()     at umbraco.cms.businesslogic.web.Document.PublishWithResult(User u)     at umbraco.presentation.publishingService.CheckPublishing(Object sender)


    Any ideas?
    Looks like Embedded Content is throwing an exception and the publish process is bombing out?


  • Drew 165 posts 340 karma points
    Oct 31, 2011 @ 15:49

    Checked this out and it's definitely an issue with Embedded Content.

    A document type instance that does not have an Embedded Content property publishes fine using the 'Publish At' feature, but w doc type that has a property using Embedded Media data type won't (and logs the above error).

    (I also tested adding an Embedded Content property to a doc type that uses 'Publish At' fine, as soon as I do, 'Publish At' stops working and we get the error (as in original post) in the Umbraco log :(  )


  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Nov 01, 2011 @ 13:02

    +1 on this, I'm getting the same error when trying to publish using publish at on Documents with Embedded Content in. Running on 4.7.1.

  • Drew 165 posts 340 karma points
    Nov 04, 2011 @ 14:06

    Found the bug.

    In DataEditor.cs, of the Initialize() method, at line 95 there's the following call to get the full path of the umbraco node service:


                var filePath = HttpContext.Current.Server.MapPath("~/umbraco/webservices/UmbracoNodeNameService.asmx");


    This value is then used to check that the service exists, etc, before anything else proceeds.

    The call to HttpContext.Current works fine when you Publish a page manally - but when a page publish is triggered by the timer event (by using Publish At), there is no HttpContext.Current - it's null.

    So this call fails, the exception bubbles up to the top of the stack and the page fails to publish.

    A very simple (and tested) solution is to replace the MapPath call to a version that works regardless of a Context.
    So simply replace it with:

     var filePath = HostingEnvironment.MapPath("~/umbraco/webservices/UmbracoNodeNameService.asmx"

    And it works fine :)



Please Sign in or register to post replies

Write your reply to: