[SOLVED] v2.4 & v2.5 Change sets: Nop.Admin.Controllers.NetAdvImageController parameterless public constructor error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Thought I should post a fix as it might help someone to an issue I ran into while updating my v2.40 release with the latest change sets up to and including Change Set 6aeceb053ba4

BUG: The Image Editor feature of the TinyMCE rich text editor fails with the error at the bottom of this post

CHANGE SETS
Change Set 4109e0f619a7: Removed Autofac's ExtensibleActionInvoker during initial dependency registration. InjectActionInvoker breaks checkout/completed route
Change Set e39f0ec47290: Register Autofac's ExtensibleActionInvoker during initial dependency registration, allowing plugins to easily register filters.

FIX
Change Set 4109e0f619a7 undoes some of the changes made in change set e39f0ec47290. However, I found that I also needed to reinstate the lines of code below in the file: \Presentation\Nop.Web.Framework\DependencyRegistrar.cs

LINE 55
using Nop.Web.Framework.UI.Editor; //UNDO Change Set e39f0ec47290

LINES 260 - 262
//HTML Editor services
builder.RegisterType<NetAdvDirectoryService>().As<INetAdvDirectoryService>().InstancePerHttpRequest(); //UNDO Change Set e39f0ec47290
builder.RegisterType<NetAdvImageService>().As<INetAdvImageService>().InstancePerHttpRequest(); //UNDO Change Set e39f0ec47290


ERROR LOG
An error occurred when trying to create a controller of type 'Nop.Admin.Controllers.NetAdvImageController'. Make sure that the controller has a parameterless public constructor.

System.InvalidOperationException: An error occurred when trying to create a controller of type 'Nop.Admin.Controllers.NetAdvImageController'. Make sure that the controller has a parameterless public constructor. ---> System.MissingMethodException: No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) --- End of inner exception stack trace --- at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.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.<>c__DisplayClass6.<BeginProcessRequest>b__2() at System.Web.Mvc.SecurityUtil.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust[TResult](Func`1 func) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
12 years ago
Just tested. Everything works. If you open \Presentation\Nop.Web.Framework\DependencyRegistrar.cs file, then you can see that it contains the following lines of code:
builder.RegisterType<NetAdvDirectoryService>().As<INetAdvDirectoryService>().InstancePerHttpRequest();
builder.RegisterType<NetAdvImageService>().As<INetAdvImageService>().InstancePerHttpRequest();


Please  try the latest available version
12 years ago
Thanks for your reply.

The version I have is working OK, but I'll be sure to check your latest version if I make any further changes.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.