AOT: skip HOCON-based Type
loading for default implementations
#7431
Labels
Milestone
Type
loading for default implementations
#7431
Consider the following:
akka.net/src/core/Akka/Actor/Settings.cs
Lines 96 to 100 in 61bdebf
This creates a problem for AOT'd applications because of the type loading across assemblies, which is verbotten under AOT compilation rules. For these types of issues, we have to refer users to the configuration sources such as our
Setup
classes (which use direct references, not assembly loading - and therefore is kosher.)But for other cases, such as:
Default Log Formatter
akka.net/src/core/Akka/Actor/Settings.cs
Lines 166 to 170 in 61bdebf
STD Out Logger
akka.net/src/core/Akka/Actor/Settings.cs
Lines 134 to 138 in 61bdebf
Mailboxes
akka.net/src/core/Akka/Dispatch/Mailboxes.cs
Lines 62 to 75 in 61bdebf
Scheduler
akka.net/src/core/Akka/Actor/Internal/ActorSystemImpl.cs
Lines 283 to 286 in 61bdebf
Dispatchers
Dispatchers are an example of where we already implement "the fix" I'm going to suggest for making Akka.NET's configuration system more AOT-friendly - skipping reflection and resolving known types when we know the HOCON matches a type that is already part of the core Akka assembly:
akka.net/src/core/Akka/Dispatch/Dispatchers.cs
Lines 587 to 616 in 61bdebf
Custom Mailboxes, Dispatchers, Etc
Doing AOT with customizable components like a user-defined
Mailbox
orDispatcher
configuration is going to be more challenging. If Akka.Hosting is still AOT-friendly (which I assume it is, beyond the parts of core Akka that are not) then we could probably introduce some customSetup
classes that allow these types to be passed in by reference rather than dynamically loaded from an assembly. That will likely need to be a second phase of AOT support after the core library is cleaned up.The text was updated successfully, but these errors were encountered: