1

I am having an issue and i'm stumped so I'm hoping someone can help.

It looks like structuremap is having an issue building the controller. I know everything is built properly because a) this has been in production for years and b) the link i'm following when I get the error is from the same controller.

I am unable to reproduce this on my dev machine. Could anyone give me some clues?

2017-09-19 08:00:45,231 [563] ERROR WebPortal.Global [(null)] - Object 
reference not set to an instance of an object.   at 
WebPortal.Controllers.EnrollmentController..ctor(ISystemUtility 
systemUtility, IObjectAdapter`2 userToCurrentUserViewModelAdapter, ILogger 
logger)
at lambda_method(Closure , IBuildSession , IContext )

2017-09-19 08:00:45,184 [563] ERROR WebPortal.Global [(null)] - Error while 
building type WebPortal.Controllers.EnrollmentController.  See the inner 
exception for details
1.) new EnrollmentController(*Default of ISystemUtility*, *Default of 
IObjectAdapter<User, CurrentUserViewModel>*, *Default of ILogger*)
2.) WebPortal.Controllers.EnrollmentController
3.) Instance of WebPortal.Controllers.EnrollmentController
4.) Container.GetInstance(WebPortal.Controllers.EnrollmentController)
at lambda_method(Closure , IBuildSession , IContext )
at StructureMap.Building.BuildPlan.Build(IBuildSession session, IContext 
context)
at StructureMap.SessionCache.GetObject(Type pluginType, Instance instance, 
ILifecycle lifecycle)
at StructureMap.SessionCache.GetDefault(Type pluginType, IPipelineGraph 
pipelineGraph)
at StructureMap.Container.GetInstance(Type pluginType)
at 
WebPortal.InjectableControllerFactory.GetControllerInstance(RequestContext 
requestContext, Type controllerType)
at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext 
requestContext, String controllerName)
at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, 
IController& controller, IControllerFactory& factory)
at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase 
httpContext, AsyncCallback callback, Object state)
at 
System.Web.HttpApplication.CallHandlerExecutionStep
.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& 
completedSynchronously)
Georgia
  • 11
  • 2
  • Please show some relevant code. Also please see [this post](https://stackoverflow.com/questions/4660142/) – Aleks Andreev Sep 20 '17 at 17:04
  • I am honestly not sure how to show relevant code. I click a button in a form in my view which calls a method in my controller. But for some reason the method in my controller is not being hit due to this structuremap error. I'm familiar with a null reference exception but this one is occuring in external code so I don't know how to troubleshoot it. – Georgia Sep 20 '17 at 17:34

0 Answers0