Do not separately register a typed client already registered by AddHttpClient<T>().
AddHttpClient<TClient>() already registers the typed client. Adding a separate AddTransient<TClient>(), AddScoped<TClient>(), or AddSingleton<TClient>() can override or conflict with the intended typed-client registration.
services.AddHttpClient<PaymentsClient>();
services.AddTransient<PaymentsClient>();services.AddHttpClient<PaymentsClient>();The implementation builds a lightweight IServiceCollection registration model across the compilation and reports duplicate standalone AddSingleton, AddScoped, or AddTransient registrations whose service or implementation type matches a typed client registered with AddHttpClient.
This catches traditional Startup methods, minimal hosting configuration, extension methods, registrations split across files, visible qualified type names, one- or two-generic-argument registration forms, typeof(...) service registrations such as AddTransient(typeof(PaymentsClient)), and visible factory registrations such as AddTransient<IPaymentsClient>(sp => new PaymentsClient()). Registration receivers are validated as visible IServiceCollection shapes when their declaration is available, including visible minimal-hosting builders whose Services member is typed as IServiceCollection; unresolved builder lookalikes are skipped instead of borrowing unrelated Services members in the same file. Resolved registration type names are compared namespace-sensitively, so same-named typed clients in different namespaces are skipped even when one registration uses an unqualified type name.
The code fix removes the duplicate standalone service registration and leaves the AddHttpClient<TClient>() registration intact.
Prefer removing the duplicate registration. Suppress only when a custom extension method mimics these names but does not register services.