MassTransit: System.InvalidOperationException When Using IAsyncDisposable

Is this a bug report?

Yes

Can you also reproduce the problem with the latest version?

Yes

Occurs When

When using MassTransit DI with a scoped consumer which has a dependency which only implements IAsyncDisposable.

It appears MassTransit should be calling DisposeAsync()

Stacktrace

MassTransit.ReceiveTransport: Error: R-FAULT rabbitmq://mq/report_queue 000a0000-ac16-0242-5f5f-08d794932d75 <redacted>.IMyCommand <redacted>.MyConsumer(00:00:06.8635823)

System.InvalidOperationException: '<redacted type name>' type only implements IAsyncDisposable. Use DisposeAsync to dispose the container.
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.Dispose()
   at MassTransit.Scoping.ConsumerContexts.CreatedConsumerScopeContext`3.Dispose()
   at MassTransit.Scoping.ScopeConsumerFactory`1.Send[TMessage](ConsumeContext`1 context, IPipe`1 next)
   at MassTransit.Pipeline.Filters.ConsumerMessageFilter`2.GreenPipes.IFilter<MassTransit.ConsumeContext<TMessage>>.Send(ConsumeContext`1 context, IPipe`1 next)

Environment

Dotnet version: .NET Core 3.0.0 Package: MassTransit (6.0.1) Package: MassTransit.Extensions.DependencyInjection (6.0.1)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (10 by maintainers)

Commits related to this issue

Most upvoted comments

The latest develop NuGet packages should have this properly implemented now.