-
Notifications
You must be signed in to change notification settings - Fork 132
Description
Hi there,
I wonder if serilog can load dlls (mainly sinks) dropped in the bin directory at runtime.
This feature will allow shipping a product with a default sink, while customers can later choose to use a different sink by dropping the dll in the bin directory and provide the right configuration for it.
Here is some information about the project:
- The project I am working on is a .net core project targeting .net 462 framework, so the AppDomain exists.
- The preserveCompilationContext is set to true. (false is not an option in this project)
I can see, the code in ConfigurationReader.GetSerilogConfigurationAssemblies() support assembly scanning which is exactly what I need. However, there is no way that the ConfigurationLoggerConfigurationExtensions.ConfigurationSection(...) can pass a null DependencyContext value to trigger the assembly scanning, the logic around the DependencyContext is:
dependencyContext ?? (Assembly.GetEntryAssembly() != null ? DependencyContext.Default : null
This will only be evaluated to null if:
- Dependency.Context.Default is null, which is not a suitable solution in my case as I need the preserveCompilationContext to be true.
- Assembly.GetEntryAssembly() returns null, and this only happens when it's called from unmanaged code.
- Write my own extension function that passes null to the ConfigurationSection(...). This cannot be achieved at the moment as the ConfigurationReader class is internal.
I would appreciate if you can point me to the right direction.
Thanks,
Ehab