mediatR 12.41 breaking change with IRequest
After upgrading to mediatR 12.41. I now have breaking changes with my code.
I now get the error below when calling the
Send()
in the screenshot.
'OrderCancelledCommand' cannot be used as type parameter 'TRequest' in the generic type or method 'ISender.Send<TRequest>(TRequest, CancellationToken)'.
However OrderCancelledCommand
already implements IRequest<XXX>.
To fix this compiler error, I had to make iOrderCancelledCommand inherit IRequest
as well. So
from
public class OrderCancelledCommand : IRequest<ReservationAmendmentResult>
to
public class OrderCancelledCommand : IRequest<ReservationAmendmentResult>, IRequest
Any ideas if this is the proper way to fixing this and what's causing it?![No description](https://cdn.answeroverflow.com/1306148268408967168/unnamed.png)
1 Reply
thats weird, it works fine for me
you shouldnt implement both the generic and non generec IRequest
the non generic one is for void responses
try cleaning and rebuilding