Skip to content

Instantly share code, notes, and snippets.

@normanhh3
Created January 2, 2013 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save normanhh3/4437832 to your computer and use it in GitHub Desktop.
Save normanhh3/4437832 to your computer and use it in GitHub Desktop.
[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.Practices.Unity.UnityContainer..ctor(UnityContainer parent) +32
Microsoft.Practices.Unity.UnityContainer.CreateChildContainer() +38
Unity.Mvc3.UnityDependencyResolver.get_ChildContainer() +276
Unity.Mvc3.UnityDependencyResolver.GetService(Type serviceType) +59
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +67
[InvalidOperationException: An error occurred when trying to create a controller of type '[MyCoolApp.ControllerClass]'. Make sure that the controller has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +247
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +85
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +270
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +80
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +405
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
@normanhh3
Copy link
Author

The issue is not the lack of a parameterless constructor on the controller as is advertised but the underlying NullReferenceException from my analysis.

@aleksei-krivoruchko
Copy link

Have you found any solution or workaround? got the same using version 3.5.1404.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment