Class CannotResolveDependency

Namespace
Cratis.Arc.DependencyInjection
Assembly
Cratis.Arc.Core.dll

The exception that is thrown when a dependency required by a command, provide method, validator, or query cannot be resolved from the service provider.

public class CannotResolveDependency : Exception, ISerializable
Inheritance
CannotResolveDependency
Implements
Inherited Members
Extension Methods

Remarks

This differs from a dependency that is simply unregistered and declared as nullable (which resolves to null). Here resolution actually fails — most commonly because the requested service exists but activating it fails deeper in the graph. The classic cause is calling AddCratisArc() without WithChronicle() while a command, provide method, validator, or query depends on a Chronicle service such as IEventLog, whose own dependencies only WithChronicle() registers.

Constructors

CannotResolveDependency(ParameterInfo, Exception)

Initializes a new instance of the CannotResolveDependency class for a reflected parameter.

public CannotResolveDependency(ParameterInfo parameter, Exception failure)

Parameters

parameter ParameterInfo

The parameter whose dependency could not be constructed.

failure Exception

The underlying failure captured while resolving the dependency.

CannotResolveDependency(Type, Exception)

Initializes a new instance of the CannotResolveDependency class for a service type.

public CannotResolveDependency(Type serviceType, Exception failure)

Parameters

serviceType Type

The service type that could not be resolved.

failure Exception

The underlying failure captured while resolving the dependency.