When this page is relevant
Catch ignored TryAdd calls and duplicate registrations that change single-service resolution behavior in Microsoft.Extensions.DependencyInjection.
Problem guide
This page targets teams debugging confusing registration order issues and silent overrides in service composition code.
When this page is relevant
Catch ignored TryAdd calls and duplicate registrations that change single-service resolution behavior in Microsoft.Extensions.DependencyInjection.
Recommended install command
dotnet add package DependencyInjection.Lifetime.Analyzers --version 2.2.2
Relevant diagnostics
DI012
- `TryAdd*` calls after an `Add*` already registered that service.