NancyFx / Nancy.Bootstrappers.Windsor

Nancy boostrapper for the Windsor container
http://nancyfx.org
MIT License
14 stars 24 forks source link

Castle.MicroKernel.Lifestyle.WebRequestScopeAccessor #57

Open tasoss opened 5 years ago

tasoss commented 5 years ago

Hello. I have just updated a solution with a few projects. And i get the following error.

at Nancy.Bootstrappers.Windsor.NancyPerWebRequestScopeAccessor..ctor() at lambda_method(Closure , Object[] ) at Castle.Core.Internal.ReflectionUtil.Instantiate(ConstructorInfo ctor, Object[] ctorArgs) at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) at Castle.Core.Internal.ReflectionUtil.CreateInstance[TBase](Type subtypeofTBase, Object[] ctorArgs) at Castle.MicroKernel.DefaultKernel.CreateScopeAccessor(ComponentModel model) at Castle.MicroKernel.DefaultKernel.CreateLifestyleManager(ComponentModel model, IComponentActivator activator) at Castle.MicroKernel.Handlers.DefaultHandler.InitDependencies() at Castle.MicroKernel.Handlers.AbstractHandler.Init(IKernelInternal kernel) at Castle.MicroKernel.Handlers.DefaultHandlerFactory.Create(ComponentModel model) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.CreateHandler(ComponentModel model) at Castle.MicroKernel.DefaultKernel.AddCustomComponent(ComponentModel model) at Castle.MicroKernel.Registration.ComponentRegistration1.Castle.MicroKernel.Registration.IRegistration.Register(IKernelInternal kernel) at Castle.MicroKernel.DefaultKernel.Register(IRegistration[] registrations) at Castle.Windsor.WindsorContainer.Register(IRegistration[] registrations) at Nancy.Bootstrappers.Windsor.WindsorNancyBootstrapper.RegisterModules(IWindsorContainer container, IEnumerable1 moduleRegistrationTypes) at Nancy.Bootstrapper.NancyBootstrapperBase`1.Initialise() at Nancy.Owin.NancyMiddleware.UseNancy(NancyOptions options) at Owin.AppBuilderExtensions.UseNancy(IAppBuilder builder, NancyOptions options) at DatabaseRest.Startup.Configuration(IAppBuilder app) in C:\foobar\Startup.cs:line 83

Could not load type 'Castle.MicroKernel.Lifestyle.WebRequestScopeAccessor' from assembly 'Castle.Windsor, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.

I'm using castle.windsor v5 and Nancy.Bootstrappers.Windsor 1.4.1 (i have tried v2 too) Am i doing something wrong? Thanks!

robsonj commented 5 years ago

We see the same issue, we had to move back to Castle.Windsor 4.1.1

waynebx commented 5 years ago

I had the same issue. Turned out it was a third party library that I was using that caused this (in my case it was the deprecated Castle.Windsor.Lifestyles because I wanted to use the Hybrid lifestyles). If that's also your case, you can fork the library, correct the dependencies and use the forked one in your code.

robsonj commented 5 years ago

Added Pull #58 to address this. May need some assistance to get it working with Cake. But would really like to get a new v2.0.0 of this package out there if possible please.

https://github.com/NancyFx/Nancy.Bootstrappers.Windsor/pull/58

tasoss commented 5 years ago

Hello again. I have tried to use the 2.0.0 version of nancy(during the process of updating nuget packages) and i get the same error. Is it supposed to have been fixed? Sorry i'm just confused.

tasoss commented 5 years ago

Finally i have used your repo and everything is fine. But why isn't it yet merged ? Thanks!

robsonj commented 5 years ago

I gave up trying to get help to merge it. In the end I pulled the few classes into our repo with a plan to migrate away from NancyFx

tasoss commented 5 years ago

I agree! Thanks again!