Umbraco Cloud troubleshoot null reference exception on homepage
The homepage on our umbraco cloud site started throwing exceptions this afternoon. No one has made any changes (code or backoffice) for about two months. We just started getting a null reference exception on some razor code in a template all of a sudden. I tried everything I could think of: I redeployed the site, republished the entire site, I even removed all razor code from the template, but I'm still getting the errors. I can't restore to my local (I assume because of the error), so I'm having to modify the template directly from the backoffice. I tried the live chat, but they didn't find anything. Not sure what to do at this point. Is there even anything I can do?
Thank you for responding. We were able to resolve the issue over the weekend.
We found the null reference exception, but it was on a different template than what was being logged. Since I was unable to pull down the content to my local for troubleshooting, the Umbraco support person copied the home node in the content tree so that we could delete content in the copy without losing it. Once we completely removed the content related to the template throwing the exception, we started seeing a new exception on another template. When we looked into that template, we did find a null reference exception. Once that was fixed, the page started working again.
I talked to our client that manages the content and it sounded like they did make a change on that day, but I can't find any record of it in the audit history for that page. I'm still very confused about why there's no audit history and why the exception was showing up on another template, but we're running Umbraco 7.10, so maybe this is not an issue on newer versions. Even though this is already resolved, I'll document the errors and code in case this is beneficial to anyone going forward:
Here is the error message:
Message:
An unhandled exception occurred
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at ASP._Page_Views_graphicWithDetails_cshtml.Execute() in c:\home\site\wwwroot\Views\GraphicWithDetails.cshtml:line 23
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
...
Here is the template code. It's a partial used by a nested content doctype:
Would throw an error if for some reason the Image wasn't picked for the content item, (or if the Examine Internal Index were corrupted), it can be good to check if the image is null first before writing out it's Url property eg:
Umbraco Cloud troubleshoot null reference exception on homepage
The homepage on our umbraco cloud site started throwing exceptions this afternoon. No one has made any changes (code or backoffice) for about two months. We just started getting a null reference exception on some razor code in a template all of a sudden. I tried everything I could think of: I redeployed the site, republished the entire site, I even removed all razor code from the template, but I'm still getting the errors. I can't restore to my local (I assume because of the error), so I'm having to modify the template directly from the backoffice. I tried the live chat, but they didn't find anything. Not sure what to do at this point. Is there even anything I can do?
Hi Eli
Can you provide details of the stack trace for the error, and the error message?
Can you provide the code for the homepage template?
Are other pages, beyond the homepage ok?
Do you use Modelsbuilder - and have the Models been regenerated?
Which version of Umbraco is this?
regards
marc
Hi Marc,
Thank you for responding. We were able to resolve the issue over the weekend.
We found the null reference exception, but it was on a different template than what was being logged. Since I was unable to pull down the content to my local for troubleshooting, the Umbraco support person copied the home node in the content tree so that we could delete content in the copy without losing it. Once we completely removed the content related to the template throwing the exception, we started seeing a new exception on another template. When we looked into that template, we did find a null reference exception. Once that was fixed, the page started working again.
I talked to our client that manages the content and it sounded like they did make a change on that day, but I can't find any record of it in the audit history for that page. I'm still very confused about why there's no audit history and why the exception was showing up on another template, but we're running Umbraco 7.10, so maybe this is not an issue on newer versions. Even though this is already resolved, I'll document the errors and code in case this is beneficial to anyone going forward:
Here is the error message:
Here is the template code. It's a partial used by a nested content doctype:
Other pages are/were working
We use Modelsbuilder, and I had regenerated models.
Umbraco version is 7.10.6
Hi Eli
Glad you have it all back up and running.
It's difficult to say for sure without the line numbers!
But this line:
Would throw an error if for some reason the Image wasn't picked for the content item, (or if the Examine Internal Index were corrupted), it can be good to check if the image is null first before writing out it's Url property eg:
but maybe it was something else entirely!
regards
Marc
is working on a reply...