Copied to clipboard

Flag this post as spam?

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


  • Mike 80 posts 101 karma points
    Dec 20, 2009 @ 11:40
    Mike
    0

    Object reference not set to an instance of an object in Admin Backend

    Hi,

    I was getting an error when selecting a Node on the Content tree.

    At /umbraco/editContent.aspx?id=1155 System.NullReferenceException: Object reference not set to an instance of an object.
       at umbraco.controls.ContentControl.addControlNew(Property p, TabPage tp, String Caption)
       at umbraco.controls.ContentControl..ctor(Content c, publishModes CanPublish, String Id)
       at umbraco.cms.presentation.editContent.OnInit(EventArgs e)
       at System.Web.UI.Control.InitRecursive(Control namingContainer)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     

    I did an IISreset and then the problem went Away.

    Now I have a page with a custom usercontrol in it. this is used in the editor. I had set this particular page set for auto publishing at 10:20 and at that time the error occured in the log table.

    Error publishing node: System.TypeInitializationException: The type initializer for 'umbraco.cms.businesslogic.datatype.controls.Factory' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
       at umbraco.BusinessLogic.Utils.TypeFinder.FindClassesOfType[T](Boolean useSeperateAppDomain)
       at umbraco.cms.businesslogic.datatype.controls.Factory.Initialize()
       at umbraco.cms.businesslogic.datatype.controls.Factory..cctor()
       --- End of inner exception stack trace ---
       at umbraco.cms.businesslogic.datatype.DataTypeDefinition.get_DataType()
       at umbraco.cms.businesslogic.property.Property.MakeNew(PropertyType pt, Content c, Guid versionId)
       at umbraco.cms.businesslogic.Content.createNewVersion()
       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)

    After the reset I looked at the settings of the page and the data for publishing the page was empty. I guess something went wrong here.

    ******** The strange thing is, i can publish the page manually without any trouble. ********

    When I open the node and look in the editor the control is not shown. Instead it shows:

    No macro content available for WYSIWYG editing

    This is not very bad, I do not really need to see the control in the editor. (the control is a form with some textinputs and some ajaxcontroltoolkit extenders)

    looking in the eventviewer I get this error after opening this page in the backend.

    ***************
    Exception information:

    Exception type: InvalidOperationException

    Exception message: The control with ID 'ftbe' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
    *************

     

    That is true as the scriptmanager is in the masterpage of where the control is to be shown.

     

    So all works as I would expect, except the strange thing of giving an error when the auto publish date is used...

    I want to test this to dive in deeper and check how this can be prevented, but how do I debug this?

     

     

     

     

     

     

  • anthony hall 214 posts 507 karma points
    Dec 20, 2009 @ 12:22
    anthony hall
    0

    Hi Mike, 

    add "umbdebugshowtrace=true"  to your url. 

  • anthony hall 214 posts 507 karma points
    Dec 20, 2009 @ 12:26
    anthony hall
    0

    oh my mistake, sorry i see you said in the backend ie within Umbraco. You say Custom control. Do you mean custom datatype?

  • Mike 80 posts 101 karma points
    Dec 20, 2009 @ 12:35
    Mike
    0

    hi,

    It is a usercontrol, a .NET usercontrol in a Macro.

  • Morten Bock 1867 posts 2139 karma points MVP 2x admin c-trib
    Dec 20, 2009 @ 12:36
    Morten Bock
    0

    Mike, I think this is a known error:

    http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=24993

    It is because the scheduled publishing does not always have an httpcontext, and that is what it uses to get the path used for reflection.

    It seems to be a periodic error, but a very annoying one.

  • Gustaf Lindqvist 6 posts 28 karma points
    Mar 09, 2010 @ 13:27
    Gustaf Lindqvist
    1

    Hi!

    I'm not sure if you have found the solution to this error but I though I would post our solution.

    Problem:

    We ran into this problem when an event was triggered by a FileMonitor. This we hooked up to this eventhandler in the ApplicationBase (a class that inherits from ApplicationBase). So this would mean that it didn't have any context, but as we found it is not only the HttpContext.Current that is null but also the Umbraco.Context. 

    Solution:

    In the constructor, we do have a context, so we stored this context in a variable.

    When the event was triggered we set the HttpContext.Current with the value of our variable. The neat thing is that HttpContext.Current is both Get and Set.

    After this we could also set the Umbraco.Context by initiating a new UmbracoContext(context) , where context was our locally stored HttpContext. Make sure you don't try to set the UmbracoContext twice, since this seems to be kept, but not the HttpContext. So we added a check before this is set, if (UmbracoContext.Current == null).

    By using this we could do our Document.MakeNew event "outside" the normal HttpContext.

     

    I hope this helps a bit :)

  • Nicolás Lope de Barrios 21 posts 42 karma points
    Mar 29, 2010 @ 17:08
    Nicolás Lope de Barrios
    0

    Mike, when you say "I did an IISreset and then the problem went away", you mean a site restart, or a whole IIS restart? IIS reset = IIS restart?

    thanks,

    Nico

  • Nicolás Lope de Barrios 21 posts 42 karma points
    Mar 29, 2010 @ 17:23
    Nicolás Lope de Barrios
    0

    Hi everyone,

    We have a similar problem in our production environment: created a page, set it to publish for ine date, and when the date arrived an "Object reference not set to an instance of an object" error is thrown in the whole umbraco admin backend. This means we cannot create, view or edit any page! We are working with umbraco 4.0.3, IIS 7.5 and SQL Server 2008 EE. We use it "out-of-the-box" without editing the source code or anything, since we don't have umbraco developers, so the solution posted by Gustaf is risky.

    Restarting the site from IIS did not fix it (just the site, not the entire service).

    Any suggestions?

  • Brian Manning 22 posts 43 karma points
    Jul 27, 2010 @ 00:17
    Brian Manning
    0

    I did a full iisreset and that fixed everything here. It was in a QA environment instead of in production, so if it's low-risk for you, might be worth trying.

  • priya 25 posts 45 karma points
    Dec 05, 2011 @ 10:47
    priya
    0

    I have upgarded umbraco 4.0.3 to umbraco version 4.7.1.now in the front end i am facing xslt issue

    "Object reference not set to an instance of an object.
    Object reference not set to an instance of an object.
      at umbraco.macro.GetXsltExtensionsImpl()
      at umbraco.macro.<GetXsltExtensions>b__4()
      at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
      at umbraco.macro.GetXsltExtensions()
      at umbraco.macro.AddMacroXsltExtensions()
      at umbraco.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters)
      at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)"

     

    if any one can help me out in sorting this.

Please Sign in or register to post replies

Write your reply to:

Draft