jbogard / MediatR

Simple, unambitious mediator implementation in .NET
Apache License 2.0
11.19k stars 1.18k forks source link

Error registering the generic handler type. #1064

Closed mbetanhe closed 2 months ago

mbetanhe commented 3 months ago

Hi everyone. Few hours ago I update nuget packages of my Project including MediatoR 10 to latest 12 version but I have a issue registering generic handler.

In 10 version it worked fine without problem. However, whe I use the 12 version of MediatR visual reports the next issue registering the service.

Error registering the generic handler type: ResiduosApp.Application.Features.ExtendedAttributes.Queries.GetById.GetExtendedAttributeByIdQueryHandler`4. When registering generic requests with more than two type parameters, each type parameter must have at least one constraint of type interface or class.

I try to change the implementation to transient but is has not be possible. Also I try register service manually but does not work.

image

image

image

crnd commented 3 months ago

There were changes (#1057) introduced to the registration of generic handlers in 12.3.0 and there is discussion (#1038) going on about the difficulties of the current implementation.

You can get back to the original behavior by downgrading MediatR to 12.2.0 for now.

zachpainter77 commented 2 months ago

The registration of generic handlers is now Opt-In in the latest pull request so this shouldn't be an issue any longer.

jbogard commented 2 months ago

This is fixed in the latest release.

jbogard commented 2 months ago

Also what the hell is going on with that font, it's an abomination.