Random Nullref

Oct 11, 2013 at 10:49 AM
Hi there.
We are randomly getting this error in production. We cannot reproduce it in development and there seems to be none of our code in the stack trace.
Any ideas?

System.NullReferenceException: Object reference not set to an instance of an object.
Stack trace
at NakedObjects.Web.Mvc.Controllers.NakedObjectsController.AddAttemptedValues(ObjectAndControlData\ controlData, FormCollection form)
at NakedObjects.Web.Mvc.Controllers.GenericControllerImpl.Action(ObjectAndControlData\ controlData, FormCollection form)
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.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult\ asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult\ asyncResult)
at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult\ asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult\ ar)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult\ ar)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult\ asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult\ ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Oct 11, 2013 at 11:37 AM
If you can't reproduce it in the development environment that's a bummer. Have you tried load testing it in the development envrionment i.e. could it be occuring only under heavy load?
Oct 11, 2013 at 12:00 PM
We haven't done that, no.
Oct 11, 2013 at 12:51 PM
The stack trace suggests that the error is happening right at the surface, not in the depths of the framework - so the issue might be to do with the data being passed in. Another useful technique would be to run Fiddler on a client accessing the production system, and then, when the error does arise, look at the actual http requests - and, in particular, the body (i.e. data passed in).
Oct 11, 2013 at 12:54 PM
From the code the most probable cause of the exception is that the id of the action being called is missing from the url parameters (or corrupt). That might be when an action is being invoked directly or when you're on an action dialog using eg the Find menu.

I assume from the users you lnow what they're doing when the exception happens ?

Any chance you have users who are perhaps fiddling with urls for any reason ?