Mediator does not register handlers from package assembly #262
Unanswered
MarekBalazEset
asked this question in
Q&A
Replies: 1 comment
-
Are there multiple Mediator.SourceGenerator packagereferences in the project graph here or something? Hard to tell what is wrong from just textual descriptions here, usuall would need a repro to tell what is going on. Another options is to have a look at some of the existing samples to see if you have similar patters or architectures |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I tried to replace MediatR by Mediator package in several projects. In my team, we have custom package with standards that contains some handlers. Firstly, I replaced MediatR by Mediator in this package (lets call it Standards.Processors). Then, I updated Azure Function app with Topic triggers. I updated all haldners but I wasn't able to register Mediator as
services.AddMediatorin Program.cs because I got ambiguous exception. Therefore, I used following approach:Microsoft.Extensions.DependencyInjection.MediatorDependencyInjectionExtensions.AddMediator(services, o => { o.ServiceLifetime = ServiceLifetime.Scoped; o.Assemblies = [typeof(WorkspaceForwardingHandler<>), Assembly.GetExecutingAssembly()]; });WorkspaceForwardingHandler is handler in my
Standards.Processorspackage. During running Function App (calledPricingProcessor), I got runtime exception:Exception: Mediator.MissingMessageHandlerException: No handler registered for message type: Standards.Processors.Mediation.Requests.WorkspaceForwardingRequest1[[PricingProcessor.FunctionApp.Dependencies.Mediation.Requests.GetBillingPriceRequest, PricingProcessor.FunctionApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]`
It looks like Mediator does not consider assemblies in the list. Does any one similar experience?
Beta Was this translation helpful? Give feedback.
All reactions