Closed swpudp closed 5 years ago
@swpudp
Can you recreate this issue in a Console app for .NET Core 2.x?
What IOC container are you using here? What version of Mediatr?
@syska The IOC container is Autofac of version 4.9.2,MediatR version is 6.0.0
I think i'm getting the same (From a console app) - haven't confirmed whether it's specific to Autofac yet!
I think i'm getting the same (From a console app) - haven't confirmed whether it's specific to Autofac yet!
Odd coincidence we got the same issue at roughly the same time. But my problem was daft - i had called AddMediator accidently which caused 2 instances of the notification handler to be in the container which results in them both being called.
Looks like a dependency registration issue. This can happen when you do scanning for types and (by accident) add multiple instances of the same handler to the container.
Without sample code it's hard to tell, but double check if you don't do any duplicate registrations.
you could check this quickly by resolving handlers manually. E.g.
var handlers = container.Resolve<INotificationHandler<TestNotification>>(); // use whatever method your container uses for resolving.
check 'handlers', it probably has double the amount of instances you expect.