Scrutor
Scrutor copied to clipboard
Upgrade from 4.2.2 to 5.0.1
services.AddScoped<PaymentInitiationService>()
.AddScoped<IEntityService<PaymentInitiation>>(x => x.GetRequiredService<PaymentInitiationService>())
.Decorate<IEntityService<PaymentInitiation>, PaymentInitiationServiceWithCache>()
.AddScoped<IPaymentInitiationService>(x => x.GetRequiredService<PaymentInitiationService>())
.Decorate<IPaymentInitiationService, PaymentInitiationServiceWithCache>()
.AddScoped<IPaymentInitiationAuditService>(x => x.GetRequiredService<PaymentInitiationService>());
i Upgrade to 5.0.1 and now i get
System.InvalidOperationException: 'A suitable constructor for type 'TenantConsentsServiceWithCache' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.'
It's really hard to tell what's wrong here, especially since the code posted doesn't even compile. Do you have any more details on the registered services? Preferably a runnable repro?
this is the registraticon the problem is when i register IEntityService the exception i get is A suitable constructor for type 'Plutus.QuickPay.Application.Nbg.TenantConsentsServiceWithCache' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.
I ll try to give you an executable to reproduce it
ProblemWithscruptor.zip i give you this sample project that it works with 4.2.2 and not in 5.0.1
I am also running into this issue as well with 5.01 ... dozens of my registrations using Decorate (or TryDecorate) throw this error now. 😭 Reverting back to 4.2.2 in the meantime.
I had the same problem. I used dummy handler to show the problem
services.Decorate(typeof(INotificationHandler<>), typeof(DummyHandlerDecorator<>));
.
.
.
public sealed class DummyHandlerDecorator<TNotification> : INotificationHandler<TNotification>
where TNotification : INotification
{
public DummyHandlerDecorator()
{
}
public async Task Handle(TNotification notfication, CancellationToken cancellationToken)
{
await Task.Delay(1000);
}
}
I got an error stating that no suitable constructor was found, even when I used an empty one.
Mb this will help you to find the real problem.
I have the same issue ;/
Closed by #239
Woohoo thank you very much for your efforts and diligence out there @khellang. It is appreciated. 🙏 Happy Holidays. 🎅⛄🦌
Thanks for hanging in there, @Mike-E-angelo 😅🙏🏻 Happy holidays to you too! 🎅🏻