Cannot activate custom Windsor component

I get a call with a Resolve call:

KernelException: Could not instantiate custom activator
Inner Exception:
{"Constructor on type 'MyProj.MyAdapter`1[[MyProj.MyBusinessObject, MyAsm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' not found."}

There is definitely an open constructor with no parameters (and I checked this with reflection at runtime) ... so I believe the problem could be due to the fact that it is common? I tried to get the component model object and set the RequiresGenericArguments parameter to true, but that didn't work out at all.

Any help would be greatly appreciated! Thank.

+3
source share
1 answer

Windsor does not use the default constructor to create activators.

In the new version, a more useful exception message appears:

Castle.MicroKernel.KernelException : Could not instantiate custom activator
  ----> System.ArgumentException : Type Castle.Windsor.Tests.ActivatorWithoutCorrectConstructor does not have a public constructor matching arguments of the following types:
Castle.Core.ComponentModel
Castle.MicroKernel.DefaultKernel
Castle.MicroKernel.ComponentInstanceDelegate
Castle.MicroKernel.ComponentInstanceDelegate

,

public YourActivator(ComponentModel model, IKernel kernel,
                                    ComponentInstanceDelegate onCreation,
                                    ComponentInstanceDelegate onDestruction)
+5

Source: https://habr.com/ru/post/1749687/


All Articles