UseConsumeFilter之后,MassTransit.dll中的NullReferenceException

问题描述

我正在尝试注册我的作用域使用过滤器:

serviceCollectionConfigurator.UsingAzureServiceBus((context,cfg) =>
{
    //some code...

    cfg.UseConsumeFilter(typeof(MyFilter<>),context);
});

但是随后在运行时,当应该使用消息时,我在Masstransit.dll中得到了NullReferenceException。它甚至不访问过滤器的构造函数。当我删除此过滤器注册或更改过滤器并将其注册为非范围过滤器时,一切正常。我的问题可能是什么原因?

过滤器代码

public class MyFilter<T> : IFilter<ConsumeContext<T>> where T : class
    {
        public MyFilter()
        {
        }

        public void Probe(ProbeContext context)
        {
            context.CreateFilterScope("ExternalMessageFilter");
        }


        public async Task Send(ConsumeContext<T> context,IPipe<ConsumeContext<T>> next)
        {
        }
    }

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)