tillig / tillig.github.io

Travis Illig's blog.
http://www.paraesthesia.com
2 stars 1 forks source link

Method not found: 'Void Autofac.RegistrationExtensions.RegisterModule(Autofac.ContainerBuilder, Autofac.Core.IModule) #3

Closed RahulRParmar closed 9 years ago

RahulRParmar commented 9 years ago

I am getting error like Method not found: 'Void Autofac.RegistrationExtensions.RegisterModule(Autofac.ContainerBuilder, Autofac.Core.IModule) When I updated the latest version of Asp.net MVC Application.

My application are using

Autofac.Mvc5 Autofac.WebAPI WebAPI2.2 Help Page and other dlls are as well. After installed Webapi2.2 help-page, I got security issue in Autofac so as per suggestions by google I have updated the latest version of Autofac.

After updating the AutoFac MVC5 and WebAPI versions, I got above error while trying to use RegisterModule more than one times. Please find my code as below

var builder = new ContainerBuilder();

builder.RegisterModule(new xyz());

builder.RegisterModule(new abc());

builder.Build(); I tried multiple solution to resolve but not got a success. Could you please pass me the correct solution to resolve?

Thanks

Hi Will,Thanks for response. Actually RegisterModule is working fine if I registerd with only one module like var builder = new ContainerBuilder(); builder.RegisterModule(new xyz()); builder.Build(); I am gettting error while trying to add more than one module.

Can you show your packages.config so we can see the versions of things you have installed? Also, do any of your modules register other modules internally? – Travis Illig 5 hours ago

Nope, that's not correct at all. Method not found: 'Void Autofac.RegistrationExtensions.RegisterModule(Autofac.ContainerBuilder, Autofac.Core.IModule) means the method is not found. You don't just lose a method between calls. You can't call it once, then have it fail the next time. The binder is locating what it thinks is the correct assembly, loading it into the appdomain, and when trying to find that method signature it is failing. What you believe or are assuming is happening is not. Stop Go look at the methods on the type. Use a disassembler if necessary. –

Hi Travis, Please find packages.config file as below, let me know if you need more info ;

If you have any problem to read please give me your email Id i will pass u config file in an email. –

tillig commented 9 years ago

I am the same Travis responding in your StackOverflow question. Let's keep the discussion going over there. Thanks!