Skip to content

Multiple constructors accepting all given argument types have been found in type 'Auth0.ManagementApi.HttpClientManagementConnection'. #959

@torin-martin

Description

@torin-martin

Checklist

  • I have looked into the Readme and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

When registering Auth0ManagementClient on application startup
builder.Services.AddAuth0ManagementClient().AddManagementAccessToken();

When injecting IManagementApiClient, following exception is thrown

System.InvalidOperationException: A suitable constructor for type 'HttpClientManagementConnection' could not be located. A Typed client must provide a constructor taking a 'System.Net.Http.HttpClient' as a parameter. ---> System.InvalidOperationException: Multiple constructors accepting all given argument types have been found in type 'Auth0.ManagementApi.HttpClientManagementConnection'. There should only be one applicable constructor.

Issue appears to be related to additional constructor added to ManagementApiClient here

Reproduction

  1. Register IManagementApiClient with builder.Services.AddAuth0ManagementClient().AddManagementAccessToken();
  2. Inject IManagementApiClient dependency
  3. Observe System.InvalidOperationException exception at runtime

Additional context

No response

auth0.net version

7.46.0

.NET version

8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis points to a verified bug in the code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions