This document is the stable reference for diagnostic IDs, descriptions, and example scenarios. IDs and anchors are stable; message text is localized.
- Description: Unable to resolve a dependency in the object graph.
- Problem: The generator cannot find a binding or auto-binding that satisfies a required injection.
- Fix: Add a binding for the missing abstraction or enable/allow auto-binding for the concrete type.
- See: injections-of-abstractions.
- Examples: A root depends on a service that has no binding.
- Description: Binding cannot be built due to missing binding metadata.
- Problem: A binding is missing required information (type, source, or factory).
- Fix: Ensure the binding has a valid
.Bind(...).To<...>()or.Bind(...).To(ctx => ...)chain. - See: simplified-binding.
- Examples: Binding is incomplete or the setup call is malformed.
- Description: Binding is invalid because the compiler reported errors.
- Problem: The compiler produced errors in code used by the binding.
- Fix: Fix compilation errors in the referenced type or factory code.
- See: simplified-binding.
- Examples: Binding references a type that failed to compile.
- Description: Composition type name is invalid.
- Problem: The composition name is not a valid C# type name.
- Fix: Use a valid identifier or fully qualified type name (letters/digits/underscore).
- See: composition-roots.
- Examples:
DI.Setup("Bad Name!").
- Description: Root name is invalid.
- Problem: The root property/method name is not a valid identifier.
- Fix: Use a valid C# identifier without spaces or punctuation.
- See: composition-roots.
- Examples:
Root<Service>("Bad Name!").
- Description: Duplicate root names detected.
- Problem: Multiple roots produce the same generated member name.
- Fix: Rename one of the roots to a unique name.
- See: composition-roots.
- Examples: Two roots with the same name.
- Description: Argument name is invalid.
- Problem: Argument name is not a valid C# identifier.
- Fix: Use a valid identifier, for example
argNameortimeoutSeconds. - See: composition-arguments.
- Examples:
Arg<int>("bad name").
- Description: Composition argument type is based on a generic marker.
- Problem: Composition arguments cannot use
TTor marker-based types. - Fix: Replace marker types with concrete types or proper generic parameters.
- See: composition-arguments.
- Examples:
Arg<TT>("arg").
- Description: Accumulator type is based on a generic marker.
- Problem: Accumulators cannot be defined with marker-based types.
- Fix: Use a concrete accumulator type or a valid generic type.
- See: accumulators.
- Examples:
Accumulator<TT>().
- Description: Accumulator cannot accumulate a generic marker.
- Problem: The accumulated element type is marker-based.
- Fix: Use concrete types or valid generic arguments for accumulated values.
- See: accumulators.
- Examples: Accumulator value uses
TT.
- Description: Special type cannot be a generic marker.
- Problem:
SpecialType<T>does not accept marker-based types. - Fix: Use concrete or supported special types.
- See: simplified-binding.
- Examples:
SpecialType<IComparer<TT>>().
- Description: Implementation does not implement the contract.
- Problem: The bound implementation does not satisfy the abstraction.
- Fix: Bind the correct implementation or change the contract to match.
- See: injections-of-abstractions.
- Examples:
Bind<IService>().To<Service>()whereServicedoes not implementIService.
- Description: Attribute argument position is invalid.
- Problem: The attribute argument index does not exist.
- Fix: Use a valid argument index or adjust the attribute definition.
- See: custom-attributes.
- Examples: Attribute argument index is out of range.
- Description: Attribute member cannot be processed.
- Problem: The attribute usage is ambiguous or conflicting.
- Fix: Use a single, unambiguous attribute or remove duplicates.
- See: custom-attributes.
- Examples: Multiple attributes cause ambiguity.
- Description: Root type is invalid.
- Problem: Root declaration does not provide a valid type argument.
- Fix: Use
Root<T>with a valid type. - See: roots.
- Examples:
Root()without a type argument.
- Description: Roots type is invalid.
- Problem: The roots API requires a non-
objecttype. - Fix: Use a specific service/abstraction type.
- See: roots.
- Examples:
Roots<object>().
- Description: No type matched the wildcard filter.
- Problem: The wildcard filter excluded all candidate types.
- Fix: Adjust the filter or remove it to include matching types.
- See: roots-with-filter.
- Examples:
Roots<IService>(filter: "NoMatch*").
- Description: Builders type is invalid.
- Problem: The builders API requires a non-
objecttype. - Fix: Use a specific type for builders.
- See: builders.
- Examples:
Builders<object>().
- Description: Builder type is invalid.
- Problem: Builder declaration does not provide a valid type argument.
- Fix: Use
Builder<T>with a valid type. - See: builder.
- Examples:
Builder()without a type argument.
- Description: Too many type parameters provided.
- Problem: The API call uses more generic arguments than supported.
- Fix: Remove extra type arguments or use the correct overload.
- See: generics.
- Examples: Invalid generic API usage.
- Description: Async factories are not supported.
- Problem:
asynclambdas are not supported in factory bindings. - Fix: Use a synchronous factory or wrap async logic outside the composition.
- See: factory.
- Examples:
.To(async ctx => ...).
- Description: Unsupported syntax in DI API.
- Problem: The generator encountered an expression it cannot process.
- Fix: Use supported API patterns (constants, simple expressions, or factories).
- See: factory.
- Examples: Unsupported expressions passed into
Bind/To/Root.
- Description: Value must be of a specific type.
- Problem: A constant of the expected type is required.
- Fix: Provide a constant literal or use a supported API call.
- See: tags.
- Examples: Tag or hint expects a constant value.
- Description: Identifier is invalid.
- Problem: A name used in setup is not a valid identifier.
- Fix: Use a valid identifier (letters/digits/underscore; no spaces).
- See: composition-roots.
- Examples: Root or builder name is not a valid C# identifier.
- Description: Context is used directly where it is not allowed.
- Problem:
ctxis used as a value rather than calling its methods. - Fix: Replace direct usage with
ctx.Inject(...)orctx.Override(...). - See: factory.
- Examples:
ctxused as a value instead ofctx.Inject(...).
- Description: Initializers count does not match.
- Problem: Factory initializers do not align with generated markers.
- Fix: Ensure the factory uses only supported initializer patterns.
- See: factory.
- Examples: Factory code does not match initializer markers.
- Description: Lifetime does not support cyclic dependencies.
- Problem: The dependency graph contains cycles incompatible with the lifetime.
- Fix: Break the cycle or change lifetimes to compatible ones.
- See: scope.
- Examples: Singleton depending on Scoped with cycles.
- Description: Composition is too large to build.
- Problem: Graph exploration exceeded the maximum iteration limit.
- Fix: Reduce graph size or adjust limits if supported.
- See: composition-roots.
- Examples: Graph iteration limit exceeded.
- Description: Cannot construct an abstract type.
- Problem: The binding points to an abstract class or interface.
- Fix: Bind to a concrete implementation type.
- See: auto-bindings.
- Examples: Binding to an abstract class.
- Description: No accessible constructor found.
- Problem: No public/internal constructors are available.
- Fix: Add an accessible constructor or use a factory binding.
- See: auto-bindings.
- Examples: Only private constructors are available.
- Description: Dependency graph cannot be built.
- Problem: The graph cannot converge to a resolved state.
- Fix: Check for missing bindings or conflicting lifetimes.
- See: resolve-methods.
- Examples: Variational graph resolution failed.
- Description: Maximum number of iterations reached.
- Problem: Graph building exceeded configured iteration limit.
- Fix: Simplify the graph or increase the limit.
- See: composition-roots.
- Examples: Graph build exceeded max iterations.
- Description: No accessible constructor found for Tag.On.
- Problem: No constructor matches the Tag.On criteria.
- Fix: Update the type or the Tag.On arguments to match a constructor.
- See: tag-on-a-constructor-argument.
- Examples:
Tag.OnConstructorArg<T>(...)with no matching constructor.
- Description: No accessible method found for Tag.On.
- Problem: No method matches the Tag.On criteria.
- Fix: Update the type or the Tag.On arguments to match a method.
- See: tag-on-a-method-argument.
- Examples:
Tag.OnMethodArg<T>(...)with no matching method.
- Description: No accessible field or property found for Tag.On.
- Problem: No field/property matches the Tag.On criteria.
- Fix: Update the type or the Tag.On arguments to match a member.
- See: tag-on-a-member.
- Examples:
Tag.OnMember<T>(...)with no matching member.
- Description: Expression must be a valid API call.
- Problem: A non-constant or unsupported expression was provided.
- Fix: Use a constant, a supported API call, or rewrite the expression.
- See: tags.
- Examples: Passing a non-constant expression to Tag or Hint.
- Description: Regular expression is invalid.
- Problem: The regex pattern cannot be parsed.
- Fix: Fix the regex syntax or escape special characters.
- See: oncannotresolve-regular-expression-hint.
- Examples: Invalid regex in a hint filter.
- Description: Wildcard is invalid.
- Problem: The wildcard pattern is malformed.
- Fix: Use supported wildcard syntax.
- See: oncannotresolve-wildcard-hint.
- Examples: Invalid wildcard pattern in a hint filter.
- Description: DI setup could not be found.
- Problem: DependsOn refers to a setup that does not exist.
- Fix: Add the missing setup or correct the name.
- See: dependent-compositions.
- Examples:
DependsOn("MissingSetup").
- Description: Cyclic dependency detected.
- Problem: A dependency cycle exists in the graph.
- Fix: Break the cycle or introduce a factory/Func to defer construction.
- See: injection-on-demand.
- Examples:
A -> B -> A.
- Description: Language version is not supported.
- Problem: The project uses a C# version below the required minimum.
- Fix: Increase the language version in project settings.
- See: composition-roots.
- Examples: Using C# language version below the minimum.
- Description: Lifetime validation error.
- Problem: A root/lifetime combination is not allowed.
- Fix: Change lifetimes or root kind to a compatible configuration.
- See: static-root.
- Examples: Static root depends on Scoped/Singleton in unsupported way.
- Description: Type cannot be inferred.
- Problem: The generator cannot determine the type from the expression.
- Fix: Specify the type explicitly (generic argument or cast).
- See: overrides.
- Examples:
Override(...)without an inferable type.
- Description: Unhandled generator error.
- Problem: An unexpected exception occurred in the generator.
- Fix: Reduce the scenario and report a bug with repro steps.
- See: check-for-a-root.
- Description: DependsOn requires a setup context name when using a setup context kind (except Members).
- Problem:
DependsOnwas called with a setup context kind but without a context name. - Fix: Provide a non-empty
namevalue or useDependsOn(params string[] setupNames)when a context is not needed.SetupContextKind.Membersallows omittingname. - Examples:
DependsOn(setupName, contextKind)without providingnameparameter.
- Description: Binding has been overridden.
- Problem: A later binding replaces an earlier one for the same contract/tag.
- Fix: Remove the earlier binding or add tags to distinguish them.
- See: overriding-the-bcl-binding.
- Examples: Two bindings for the same contract/tag, the latter wins.
- Description: No composition roots defined.
- Problem: The composition exposes no roots.
- Fix: Add at least one
.Root(...)declaration. - See: composition-roots.
- Examples:
DI.Setup("Composition")without any.Root(...).
- Description: Implementation does not implement the contract.
- Problem: The implementation does not satisfy the requested contract.
- Fix: Use a correct implementation or adjust the contract.
- See: injections-of-abstractions.
- Examples: Severity is Warning for not implemented contract.
- Description: Binding is not used.
- Problem: The binding is never requested by any root.
- Fix: Remove unused bindings or reference them in a root.
- See: composition-roots.
- Examples: Binding has no consumers in the graph.
- Description: Tag.On injection site is not used.
- Problem: The tag-on site is never matched by any injection.
- Fix: Update the Tag.On expression or add matching injections.
- See: tag-on-injection-site.
- Examples:
Tag.On(...)not referenced by any injection.
- Description: Resolve methods are incompatible with root arguments.
- Problem:
Resolvecannot provide values for root arguments. - Fix: Disable Resolve methods or remove RootArg usage.
- See: resolve-methods.
- Examples: Root uses
RootArgbutResolveis enabled.
- Description: Resolve methods are incompatible with type arguments.
- Problem:
Resolvecannot supply generic type arguments. - Fix: Use explicit roots or avoid Resolve for generic roots.
- See: resolve-methods.
- Examples: Generic roots with
Resolvemethods.
- Description: DependsOn uses an instance member.
- Problem: A binding in a dependent setup references an instance member that will not exist in the dependent composition.
- Fix: Use
.DependsOn(setupName, contextArgName)to pass an explicit setup context, or move the value toArg/RootArgor a separate context object. - See: dependent-compositions.
- Examples: Binding in a dependent setup uses instance field/property.
- Description: Generation was interrupted.
- Problem: Generation aborted early due to a handled exception.
- Fix: Inspect preceding errors for the root cause.
- See: check-for-a-root.
- Examples: Generation aborted due to a handled exception.
- Description: Implementation does not implement the contract.
- Problem: The implementation does not satisfy the requested contract.
- Fix: Use a correct implementation or adjust the contract.
- See: injections-of-abstractions.
- Examples: Severity is Info for not implemented contract.