Skip to content

Ambiguous method call between multiple Moq.AutoMock.AutoMockerKeyedServicesExtensions.WithKeyedService #410

@burger100

Description

@burger100

After upgrading to Moq.AutoMocker 3.6.1, I got the following error in the AutoMocker generated code:

The call is ambiguous between the following methods or properties: 
'Moq.AutoMock.AutoMockerKeyedServicesExtensions.WithKeyedService<TService, TImplementation>(Moq.AutoMock.AutoMocker, TImplementation, object?)' 
and 
'Moq.AutoMock.AutoMockerKeyedServicesExtensions.WithKeyedService<TService, TImplementation>(Moq.AutoMock.AutoMocker, TImplementation, object?)'
In File AutoMockerKeyedServicesExtensions.g.cs

In the source code, I found a test related to this feature flag that validate if the method should be created or not:
EnableMoqAutoMockerKeyedServicesGenerator

Trying to disable it by adding the following to my csproj doesn't work

<PropertyGroup>
 <EnableMoqAutoMockerKeyedServicesGenerator>false</EnableMoqAutoMockerKeyedServicesGenerator>
</PropertyGroup>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions