Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Proxy integration 4.3.0 doesn't work with Castle.Core 4.2.1 #25

Closed
MonkSoul opened this issue Feb 11, 2018 · 14 comments
Closed

Comments

@MonkSoul
Copy link

No description provided.

@MonkSoul MonkSoul changed the title no support Castle.Core v4.2.1 version The new version(4.3.0) no support Castle.Core v4.2.1 version Feb 11, 2018
@tillig
Copy link
Member

tillig commented Feb 11, 2018

Can you provide a bit more info here? Is there an error message? Some reproduction you can show to illustrate the problem?

@hikalkan
Copy link

I'm getting this exception for registrationBuilder.EnableClassInterceptors() method.

Message: System.IO.FileNotFoundException : Could not load file or assembly 'Castle.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'. The system cannot find the file specified.

image

I'm using Castle.Core v4.2.1 as shown in the image above.

@tillig
Copy link
Member

tillig commented Feb 11, 2018

You may need to add an assembly binding redirect to your app.config. NuGet sometimes misses that.
https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions

@hikalkan
Copy link

I've already <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> in my csproj file.

@hikalkan
Copy link

Even adding this didn't help:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

Getting the exception on runtime, it's not a build problem. So, it may not be related to nuget.

@tillig
Copy link
Member

tillig commented Feb 11, 2018

Binding redirects are a runtime thing (note the runtime element).

Is there a small repro project I can see?

@tillig
Copy link
Member

tillig commented Feb 11, 2018

Also, have you tried clearing cached items like the .vs folder? That can sometimes help.

@hikalkan
Copy link

Yes, I cleared it. I also published it and run under IIS to see the difference. Result is same.

Is there a small repro project I can see?

No, but nice idea, I can try with a simpler test project when I have time.

@tillig
Copy link
Member

tillig commented Feb 11, 2018

I was able to repro this in a small console app. Unclear why it's popping up yet or what to do about it, but at least I see it.

@tillig
Copy link
Member

tillig commented Feb 11, 2018

OK, it turns out this is a Castle.Core problem. TL;DR: They wanted to switch from changing their assembly version strategy so it's pinned at 4.0.0.0... but they did that after having released 4.1.0.0. As of Castle.Core 4.2.0, the Castle.Core package version changes but the assembly version doesn't. And they chose to go backwards to 4.0.0. assembly version instead of stopping at 4.1.0.0 and pinning there... or restarting at 5.0.0.0.

What a nightmare.

I guess the right way to handle this is to update to 4.2.1 here so the bound assembly version lines up...? This is going to be a nightmare of trickle down problems. Sigh. But I can't see any way around it. Really wish they hadn't done that without incrementing the major version.

@tillig tillig changed the title The new version(4.3.0) no support Castle.Core v4.2.1 version Dynamic Proxy integration 4.3.0 doesn't work with Castle.Core 4.2.1 Feb 11, 2018
@hikalkan
Copy link

OMG! Then upgrading dependency to 4.2.1 seems the best way.

@tillig
Copy link
Member

tillig commented Feb 12, 2018

I released v4.4.0 of Autofac.Extras.DynamicProxy that uses Castle.Core 4.2.1. I also added docs about this issue. That's the best I can do from this end.

For folks hitting this in the future, I recommend taking it up with the Castle.Core crew. This is out of the control of Autofac.

@tillig tillig closed this as completed Feb 12, 2018
@hikalkan
Copy link

Thank you @tillig for fast reaction. I just tested and it worked :)

@alexmg
Copy link
Member

alexmg commented Feb 13, 2018

Nice work @tillig. I've updated Autofac.ServiceFabric to this new release. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants