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

Autofac integration issue - Ambiguous invocation #7627

Closed
linch90 opened this issue Feb 7, 2021 · 4 comments · Fixed by #7628
Closed

Autofac integration issue - Ambiguous invocation #7627

linch90 opened this issue Feb 7, 2021 · 4 comments · Fixed by #7628
Assignees
Milestone

Comments

@linch90
Copy link
Contributor

linch90 commented Feb 7, 2021

  • ABP version: 4.2.0.

When I upgrade Abp version to 4.2.0, the AddAutofac extension method display CS0121 error: ambiguous between the "AddAutofac" in the Volo.Abp.Autofac and Autofac.Extensions.DependencyInjection 6.0.0.0

And I also create a brand new project in Abp version 4.2.0, and this problem is still exists.

image

This issue seems cause by PR #6463 which Add Autofac.Extensions.DependencyInjection package to the Volo.Abp.Autofac module

@maliming
Copy link
Member

maliming commented Feb 7, 2021

I can't reproduce this problem.

@maliming maliming closed this as completed Feb 7, 2021
@linch90
Copy link
Contributor Author

linch90 commented Feb 7, 2021

Just add package Volo.Abp.Autofac 4.2.0, in your module, add codes:

public override void ConfigureServices(ServiceConfigurationContext context)
{
    context.Services.AddAutofac(builder =>
    {

    });
}

the AddAutofac will display ambiguous problem.
This problem only show in Volo.Abp.Autofac 4.2.0, It's ok in Volo.Abp.Autofac 4.1.2 or before

@linch90
Copy link
Contributor Author

linch90 commented Feb 7, 2021

I download a new abp project from https://abp.io/get-started.

  1. Install Volo.Abp.Autofac 4.2.0 to {projectName}.Domain
  2. add below codes to {projectName}DomainModule.cs
public override void ConfigureServices(ServiceConfigurationContext context)
{
    context.Services.AddAutofac(builder =>
    {

    });
}

image

  • The problem is still exists.
    I don't know if this is a computer environmental related issue, I will try it in another computer to see if the problem is still exists.
    @maliming

@maliming maliming reopened this Feb 7, 2021
@maliming maliming self-assigned this Feb 7, 2021
@maliming maliming added this to the 4.3-preview milestone Feb 7, 2021
@maliming
Copy link
Member

maliming commented Feb 7, 2021

You can temporarily resolve it via:

services.AddSingleton<IServiceProviderFactory<ContainerBuilder>>(new AutofacServiceProviderFactory(builder =>
{

}));

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

Successfully merging a pull request may close this issue.

2 participants