Reputation: 11
I am developing an application in MVC. Everything works great when I'm debugging, in every browser. The problem is that I can't make it work once I install the application in the server, because it shows me the next exception only in IE8,:
Object reference not set to an instance of an object.
at Eco.Administration.Web.UI.Controllers.CatalogController.ProcesarListaFactoresPorFiltro(String Rama, String TipoCredito, String Periodo, String Ubicacion)
at Eco.Administration.Web.UI.Controllers.CatalogController.EcoEditaXML(String Ram, String Tip, String Perio, String ubica, Int32 Id, String mensaje)
at *lambda_method(Closure ,* ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
I have realized that when I delete a line in my controller (a lambda function) it works fine.
Does anybody knows if there is a problem in IE8 related to lambda functions? Could it be a misconfiguration in IIS?
Upvotes: 1
Views: 5666
Reputation: 3360
This is more for people stumbling onto this question while researching same problem. I just experienced it myself. I have this line of code that has been working in my app forever:
STemplate stemplate = db.STemplates.Include(t=>t.STemplateTabs).Where(t=>t.Id == id).FirstOrDefault();
All of a sudden, I started getting exceptions like these:
System.NullReferenceException: Object reference not set to an instance of an object. at WebUI.Areas.Admin.Controllers.STemplateController.Details(Int32 id) at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) etc...
I kept staring at my innocent line, trying to figure out what could be breaking. On a whim, I fired SQL Server Profiler and saw that the call actually goes through! The issue was with lines immediately below my query. In my case I was setting a cookie with value that was supposed to be in the web.config but wasn't there, hence the null reference exception. Yet another reason to do proper deployments every time instead of quickly replacing DLLs on server to quickly fix something.
Good luck!
Upvotes: 2