Copied to clipboard

Flag this post as spam?

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


  • Edvin 9 posts 99 karma points
    Sep 06, 2019 @ 21:36
    Edvin
    0

    Weird Random Null Reference Error

    Hello,

    we are getting random null Reference Errors on our website and they seemed to start getting more frequently (the site is live 1 year). After the error, only a web server restart solves the issue and the site runs normal again.

    It breaks here at the IF check:

    USNLink page = USNUrlHelper.GetLinkFromRelatedLink(link);
    
    if (page != null && (page.InternalNode.IsDocumentType(UsnblogLandingPage.ModelTypeAlias) || page.InternalNode.IsDocumentType(UsnblogCategoryPage.ModelTypeAlias)))
    

    and the stack trace:

    An unhandled exception occurred
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Umbraco.Web.PublishedContentExtensions.IsDocumentType(IPublishedContent content, String docTypeAlias)
       at ASP._Page_Views_Partials_USNStandardPageComponents_Below_Slider_Grid_cshtml.Execute() in C:\Website\ourwebsite.com\Views\Partials\USNStandardPageComponents\Below_Slider_Grid.cshtml:line 131
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
       at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at ASP._Page_Views_Partials_USNAdvancedPageComponents_USN_ComponentsSwitch_cshtml.Execute() in C:\Website\ourwebsite.com\Views\Partials\USNAdvancedPageComponents\USN_ComponentsSwitch.cshtml:line 26
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
       at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at ASP._Page_Views_Partials_USNAdvancedPageComponents_USN_AdvancedPageComponents_cshtml.Execute() in C:\Website\ourwebsite.com\Views\Partials\USNAdvancedPageComponents\USN_AdvancedPageComponents.cshtml:line 27
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
       at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at ASP._Page_Views_USNAdvancedPage_cshtml.Execute() in C:\Website\ourwebsite.com\Views\USNAdvancedPage.cshtml:line 9
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
       at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
       at System.Web.Mvc.Controller.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
       at System.Web.Mvc.MvcHandler.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    

    Any idea why this is happening, could it be something with the installation or server configuration? The error really happens totally random, it can go days/weeks without it and then it appears again.

    Our Umbraco version 7.15.2 running on a uskinned theme.

    thx

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Sep 07, 2019 @ 06:32
    Shaishav Karnani from digitallymedia.com
    0

    Hi Edvin,

    Please can you add additional check to stop this error [page.InternalNode != null]. This will atleast not break the site.

    if (page != null && page.InternalNode != null && (page.InternalNode.IsDocumentType(UsnblogLandingPage.ModelTypeAlias) || page.InternalNode.IsDocumentType(UsnblogCategoryPage.ModelTypeAlias)))

    Cheers,

    Shaishav

  • Edvin 9 posts 99 karma points
    Sep 07, 2019 @ 07:30
    Edvin
    0

    Thx Shaishav,

    I already did refactor the code and added additional Null checks, so now I wait and see if it happens again. I am just wondering how the internalnode can be null sometimes and so randomly. Wondering if it could be some caching issues on the server

    Thx!

  • Jason Cao 1 post 71 karma points
    Apr 15, 2020 @ 00:48
    Jason Cao
    0

    Hi Edvin,

    We are experiencing the same issue. Did you ever find out what was the cause of the InternalNode object being Null?

    Are you still experiencing the issue on your end as well or were you able to find a more permanent solution?

    Thank you in advance! Jase

Please Sign in or register to post replies

Write your reply to:

Draft