diff --git a/src/contrib/dependencyinjection/Akka.DI.Core/DIActorContextAdapter.cs b/src/contrib/dependencyinjection/Akka.DI.Core/DIActorContextAdapter.cs index a302e92eebd..0ca1f87b056 100644 --- a/src/contrib/dependencyinjection/Akka.DI.Core/DIActorContextAdapter.cs +++ b/src/contrib/dependencyinjection/Akka.DI.Core/DIActorContextAdapter.cs @@ -26,11 +26,15 @@ public class DIActorContextAdapter /// /// This exception is thrown when the specified is undefined. /// + /// + /// This exception is thrown when the Dependency Resolver has not been configured in the . + /// public DIActorContextAdapter(IActorContext context) { if (context == null) throw new ArgumentNullException(nameof(context), $"DIActorContextAdapter requires {nameof(context)} to be provided"); this.context = context; this.producer = context.System.GetExtension(); + if (producer == null) throw new InvalidOperationException("The Dependency Resolver has not been configured yet"); } /// diff --git a/src/contrib/dependencyinjection/Akka.DI.Core/DIActorSystemAdapter.cs b/src/contrib/dependencyinjection/Akka.DI.Core/DIActorSystemAdapter.cs index 5c32faf31e8..4e4c291cc41 100644 --- a/src/contrib/dependencyinjection/Akka.DI.Core/DIActorSystemAdapter.cs +++ b/src/contrib/dependencyinjection/Akka.DI.Core/DIActorSystemAdapter.cs @@ -26,11 +26,15 @@ public class DIActorSystemAdapter /// /// This exception is thrown when the specified is undefined. /// + /// + /// This exception is thrown when the Dependency Resolver has not been configured in the . + /// public DIActorSystemAdapter(ActorSystem system) { if (system == null) throw new ArgumentNullException(nameof(system), $"DIActorSystemAdapter requires {nameof(system)} to be provided"); this.system = system; this.producer = system.GetExtension(); + if (producer == null) throw new InvalidOperationException("The Dependency Resolver has not been configured yet"); } ///