Yes, i think so. Currently we are using Masstransit with autofac in production. We wanted to port netcoreapp2.0 and netstandard in our projects. .When i tried to move Masstransit .netstandard version and implemented an aspnetcore project, i encountered this issue.
Yes. Version is : 4.0.0.1272-develop
Autofac's lifetimescope should resolve all dependencies that provided in composition root which means on ConfigureServices step.
Autofac's Lifetimescope doesn't know all dependencies inside of a consumer. It knows only contructor injected dependencies.
I've implemented a demo about that.
LoadFrom using(framework side, it is an abstraction to use Masstransit): https://github.com/stoveproject/Stove/blob/netstandard2.0/src/Stove.RabbitMQ/StoveRabbitMQRegistrationExtensions.cs#L43
Example: https://github.com/stoveproject/Stove/tree/netstandard2.0/test/Stove.Demo.WebApi.Core
I also digged into Masstransit.Autofac's code. AutofacConsumerFactory seemed to me could be relevant, but i don't know :(
This is expected behaviour of AutofacConsumerFactory creates a nested LifetimeScope to only manage consumer dependencies, not sure why your expecting all dependencies in a single lifetime scope.
@gertjvr,
I know, as i mentioned this approach works in 3.5.7, same code is not working in .netstandard :( or i'm missing something.
Also i need to resolve hidden dependencies with ILifetimescope. In this sample _scopeResolver.IsRegistered
I'm also not sure of this issue is related with only Masstransit, could be in Autofac's ServiceProvider, just investigating and wanted to help for understand.
I found the problem. It was in my Autofac abstraction. Masstransit.Autofac works like a charm! Thx guys.
Most helpful comment
I found the problem. It was in my Autofac abstraction. Masstransit.Autofac works like a charm! Thx guys.