Castle Windsor 5.1.1 erroring after upgrading Castle-Core from 4.4.1 to 5.0.0 - Could not load PermissionUtil from Castle.Core
Asked Answered
T

1

8

I have recently used NuGet to upgrade Castle Core to 5.0.0 and Castle Windsor to 5.1.1 in my existing ASP.NET Web Project. Castle Windsor was working perfectly before the upgrade.

Now whenever I call:

...
 var container = new WindsorContainer();
...

I get the error:

...
    System.TypeLoadException
      HResult=0x80131522
      Message=Could not load type 'Castle.Core.Internal.PermissionUtil' from assembly 'Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.
      Source=Castle.Windsor
      StackTrace:
       at Castle.MicroKernel.DefaultKernel..ctor(IDependencyResolver resolver, IProxyFactory proxyFactory)
       at Castle.MicroKernel.DefaultKernel..ctor()
       at Castle.Windsor.WindsorContainer..ctor()
       at CastleTest2.Controllers.HomeController.Index() in C:\Users\jacki754\source\repos\CastleTest2\Controllers\HomeController.cs:line 14
       at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] 

       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_0.<InvokeActionMethodFilterAsynchronouslyRecursive>b__0()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2()
    ...

I can't find any specific documentation on these new versions, so does anyone know if there are any additional steps that need to be taken (e.g. in Web.Config) to set up Castle Windsor?

Turnbuckle answered 17/5, 2022 at 9:19 Comment(1)
It looks like you still have a reference to version 5.0.0 floating around in your application somewhere. I'd start by checking your project file, and ensure it's referencing the latest 5.1.1 version.Disturbing
T
7

According to this page https://groups.google.com/g/castle-project-devel/c/M94Lwdzx62I Castle Windsor is not compatible with anything over version 4.4.1 of Castle Core.

If you upgrade Castle Windsor to 5.1.2 (or greater) and leave Castle Core at 4.4.1, then it should work.

Tentage answered 19/1, 2023 at 10:12 Comment(1)
Here to confirm that "should" work does indeed work.Softhearted

© 2022 - 2024 — McMap. All rights reserved.