I am trying to understand how the Html Helpers are built inside MVC 3. So i downloaded MVC 3 source and added as another project in same solution to debug it.
I followed this steps.
Removed System.web.Mvc reference from my MVC Application
Added a System.web.Mvc Source code project reference for debugging.
In Web.config System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 to System.Web.Mvc
However i have other NInject
(NInject
, NInject.web.common
, WebActivator
, Microsoft.web.infrastructure
) references added in my MVC
3 application for dependency injection.
Now i am getting an error in System.Web.MVC
Source saying 'An error occurred when trying to create a controller of type 'MVCApp.Controllers.HomeController'. Make sure that the controller has a parameterless public constructor.
in below MVC
Source code of
public IController Create(RequestContext requestContext, Type controllerType)
{
try
{
return (IController)(_resolverThunk().GetService(controllerType)
?? Activator.CreateInstance(controllerType));
}
catch (Exception ex)
{
throw new InvalidOperationException(
String.Format(CultureInfo.CurrentCulture,
MvcResources.DefaultControllerFactory_ErrorCreatingController, controllerType),
ex);
}
}
Checking DependencyResolver.Current property says DependencyResolver.Current The type 'System.Web.Mvc.DependencyResolver' exists in both 'System.Web.Mvc.dll' and 'System.Web.Mvc.dll'
What more needs to be done in order to debug my MVC3App with MVC3 source code? how can i avoid this error?