Skip to content

Compono.CompositionRow.TryResolveConfigured(System.Type,object)

Compono

Compono.CompositionRow

CompositionRow.TryResolveConfigured(Type, object) Method

Attempts to resolve type using only Compono's configured/provider-backed resolution stages: this row's existing scope values, exact registrations, configuration rules, and registered ICompositionValueProvider instances (including Compono.TestDoubles and Compono.NSubstitute). This is NOT equivalent to Resolve<TValue>(CompositionRequestDescriptor) - it does not consult a configured IServiceProvider (UseServiceProvider), and it cannot perform ordinary generated-plan composition of arbitrary concrete types, because that dispatch requires the target type to be known at compile time. See docs/adr/0047-compono-dependencyinjection-configured-resolution-bridge.md.

public bool TryResolveConfigured(System.Type type, out object? value);

Parameters

type System.Type

The runtime type to resolve.

value System.Object

The resolved value if a configured/provider stage satisfied type; otherwise null. A legitimate handled result can itself be null - check this method's return value, not whether value is null, to tell "handled" from "not handled" apart.

Returns

System.Boolean
true if a configured/provider stage satisfied type; false if no such stage could handle it.

Exceptions

CompositionException
An exact registration factory or configuration-rule (.For<T>().Use(...)) factory threw, or the scope/registration/provider result's runtime type wasn't assignable to the requested type. A null result is never a failure here - unlike Resolve<TValue>(CompositionRequestDescriptor), this method always validates as nullable (see the parameter docs above), so a legitimate null always comes back as true, never this exception. This method distinguishes "nothing could handle this" (a false return) from "something tried and failed" (a thrown exception) - it never collapses the latter into the former.

System.Exception
A stage 4-6 ICompositionValueProvider threw - its own original exception type propagates uncaught, exactly like Resolve<TValue>(CompositionRequestDescriptor)'s existing provider-failure contract (a public provider's thrown exception is never wrapped in a CompositionException, per docs/adr/0024-public-provider-extensibility-model.md's Provider Failure Semantics) - only an exact registration or configuration-rule factory's failure gets wrapped.