I am using mass transit 7.3.1 with mass transit simple injector for sending msgs to rabbit mq and upon using the method IPublishEndpoint.Publish
(Task Publish<T>(object values, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
it throws the exception
Exception: "System.ObjectDisposedException: The CancellationTokenSource has been disposed.\n at MassTransit.Conte │ │ xt.BaseReceiveContext.get_CancellationToken()\n at MassTransit.Context.MessageConsumeContext
1.GreenPipes.PipeContext.get_CancellationToken()\n at MassTransit.Context.ConsumeContextScope.get_Cancellati │ │ onToken()\n at MassTransit.Context.ConsumeContextScope.get_CancellationToken()\n at GreenPipes.ProxyPipeContext.get_CancellationToken()\n at GreenPipes.ProxyPipeContext.get_CancellationToken()\n at │ │ GreenPipes.ProxyPipeContext.get_CancellationToken()\n at MassTransit.Initializers.MessageInitializer
2.Send(ISendEndpoint endpoint, InitializeContext`1 context, Object input)
I have tried passing the cancellation token within a using statement and also have tried passing CancellationToken.None
. But neither has helped.
Any ideas?