[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade from 4.2.2 to 5.0.1 #235

Open
giakara opened this issue Oct 18, 2024 · 6 comments
Open

Upgrade from 4.2.2 to 5.0.1 #235

giakara opened this issue Oct 18, 2024 · 6 comments

Comments

@giakara
Copy link
giakara commented Oct 18, 2024

services.AddScoped()
.AddScoped<IEntityService>(x => x.GetRequiredService())
.Decorate<IEntityService, PaymentInitiationServiceWithCache>()
.AddScoped(x => x.GetRequiredService())
.Decorate<IPaymentInitiationService, PaymentInitiationServiceWithCache>()
.AddScoped(x => x.GetRequiredService());
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.'
image

@khellang
Copy link
Owner

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?

@giakara
Copy link
Author
giakara commented Oct 21, 2024

image
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

@giakara
Copy link
Author
giakara commented Oct 22, 2024

ProblemWithscruptor.zip
i give you this sample project that it works with 4.2.2 and not in 5.0.1

@Mike-E-angelo
Copy link

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.

@dr-marek-jaskula
Copy link

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.

@KrzysztofWrobelMetaPack

I have the same issue ;/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants