alsami / MediatR.Extensions.Autofac.DependencyInjection

Autofac plug-in for MediatR.
MIT License
55 stars 14 forks source link

error after upgrading to 5.0.0 #5

Closed codingL3gend closed 4 years ago

codingL3gend commented 4 years ago

receiving below error after upgrading to 5.0.0. currently also on 5.0.0 autofac, 8.0.0 mediatr as well. this error results after a call to builder.AddMediatr with a collection of assemblies. i am also on .net core 3.1

Assemblies = new List<Assembly>(); builder.AddMediatR(Assemblies);

Method not found: 'Autofac.ContainerBuilder MediatR.Extensions.Autofac.DependencyInjection.ContainerBuilderExtensions.AddMediatR(Autofac.ContainerBuilder, System.Collections.Generic.ICollection`1)'.

alsami commented 4 years ago

Hi. Thanks for reporting this. Are you talking about a runtime error or a compile time error? If so, did you check the changelog? I've recently removed some overloads.

Please provide a sample project in case this is a runtime error.

codingL3gend commented 4 years ago

this is a runtime error that is currently occurring. i did look at the changelog but didn't see anything conclusive that would contribute to this issue occurring. i've also noticed something similar in the autofac dependencies for moq repo and have also created an issue for them as well so this may be a cascading thing here is the link for reference [https://github.com/autofac/Autofac.Extras.Moq/issues/28](Autofac Issue).

it appears to happen in a very specific scenario. i will try to get a sample project to you as soon as i can.

alsami commented 4 years ago

this is a runtime error that is currently occurring. i did look at the changelog but didn't see anything conclusive that would contribute to this issue occurring. i've also noticed something similar in the autofac dependencies for moq repo and have also created an issue for them as well so this may be a cascading thing here is the link for reference [https://github.com/[autofac/Autofac.Extras.Moq/issues/28](https://github.com/autofac/Autofac.Extras.Moq/issues/28)](Autofac Issue).

it appears to happen in a very specific scenario. i will try to get a sample project to you as soon as i can.

Ah, so it's not actually related to this project. Yes, we haven't upgraded the Moq extensions yet. They rely on mutable container. Since 5.0.0 of Autofac the containers are immutable. You can fix that by downgrading to version 4.0.0 of this library.

codingL3gend commented 4 years ago

yeah my unit test at the moment that rely on automook are shot until they release the updates. however for this library i was able to get around the issue for now by simply passing in the assemblies individually instead of as a collection. that will suffice for now.

alsami commented 4 years ago

yeah my unit test at the moment that rely on automook are shot until they release the updates. however for this library i was able to get around the issue for now by simply passing in the assemblies individually instead of as a collection. that will suffice for now.

You can pass in an array instead of a list. I removed some overloads recently which is also listed as a breaking change in the changelog. For the Moq extensions you will have to wait a litt bit. Closing this issue, feel free to open a new one in case you still encounter problems.