You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version Information
Version of Akka.NET? 1.4.35
Which Akka.NET Modules? Akka.DependencyInjection
Describe the bug
Originally posted in stackoverflow
DI fails to throw an exception when DI tried to create an actor with missing constructor parameter. ie. the constructor parameter was not provided both in the props parameter and does not exist in the service provider.
To Reproduce
Steps to reproduce the behavior:
Reproduction spec: #5735
Expected behavior
ActorSystem.ActorOf() should throw when DI failed to instantiate the actor class
Actual behavior
ActorSystem.ActorOf() returned an IActorRef with a null actor inside its ActorCell
The text was updated successfully, but these errors were encountered:
After reviewing the actor creation code and design, this is found to be not a bug.
Actor creation in Akka.NET happens as a 2 step process:
An empty actor holder is returned by the ActorOf method, this holder contains the Mailbox and ActorCell. ActorCell contains the Props needed by the system to re/create the actor as needed.
A Create system message is enqueued into the Mailbox, triggering the actual Actor instantiation.
This is essentially a "bubble" where the actor code lives, any exception thrown by any code at step 2 onward are blocked from propagating to the application layer and instead propagated up the chain of actors above it, letting them decide on what would happen to the faulting actors. Since the DI exception happened on step 2 of the process, the exception would never reach the code that actually calls the ActorOf method and instead be propagated up to the guardian actor and be logged as an error in the log.
Version Information
Version of Akka.NET? 1.4.35
Which Akka.NET Modules? Akka.DependencyInjection
Describe the bug
Originally posted in stackoverflow
DI fails to throw an exception when DI tried to create an actor with missing constructor parameter. ie. the constructor parameter was not provided both in the props parameter and does not exist in the service provider.
To Reproduce
Steps to reproduce the behavior:
Reproduction spec: #5735
Expected behavior
ActorSystem.ActorOf() should throw when DI failed to instantiate the actor class
Actual behavior
ActorSystem.ActorOf() returned an IActorRef with a null actor inside its ActorCell
The text was updated successfully, but these errors were encountered: