Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persistent Object Reference Not Set Error With [No relevant source lines]

Tags:

c#

asp.net-mvc

I have been happily developing an MVC/Sitecore App and all was fine.

However all of a sudden I got an error telling me that I had a Object reference not set to the instance of an Object going on. The error page pointed to a line that had nothing other that a closing brace.

I tried removing the lines of code in the view that could be causing the error but the error remained on the same closing brace.

So I commented out the whole block including the closing brace. Now I am getting the following error:

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

[No relevant source lines]

Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\1a47b3ff\21a05ef3\App_Web_kieomnc4.1.cs Line: 0

[NullReferenceException: Object reference not set to an instance of an object.]
ASP._Page_Views_MyCompany_Common_AddressEdit_cshtml.Execute() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\1a47b3ff\21a05ef3\App_Web_pjrqnchq.1.cs:0
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +279
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +124
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +109
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +379 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +108
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +890
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +890
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList
1 filters, ActionResult actionResult) +97
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +879

I have stopped the WWW service completely, closed Visual Studio, deleted all the temp files from the Temporary ASP.NET folder, restarted the service, reloaded Visual Studio but still the error remains.

Can anyone make any suggestions?

like image 404
Fred Avatar asked Oct 31 '22 04:10

Fred


2 Answers

In case anyone else stumbles on this, I deleted the website in IIS then recreated it and the error disappeared. Same files in the same location, just IIS.

like image 175
Fred Avatar answered Nov 15 '22 05:11

Fred


  1. Open IIS
  2. Stopped the IIS server
  3. Delete the folders under the following directory: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root
  4. Start the IIS server back up.
  5. Try loading your page again.
like image 29
Jabare Mitchell Avatar answered Nov 15 '22 03:11

Jabare Mitchell