serilog-settings-configuration icon indicating copy to clipboard operation
serilog-settings-configuration copied to clipboard

ConfigurationReader is attempting to load assemblies not associated with the project but found by the DllScanningAssemblyLoader

Open yankun opened this issue 1 year ago • 7 comments

I've found following bug:

The DllScanningAssemlyFinder is scanning the Application's directory for dlls containing .serilog in its name. Later on the ConfigurationReader attempts to load the results with the Assembly.Load function.

Unfortunately Assembly.Load only works with assemblies referenced by the application and does no actual disk lookup. So a user attempted to add a new sink to an application, copying manually the sink's dll into the folder will have no success, as the Dll scanner will find the dll but the ConfigurationReader is unable to load it and the application will crash with a FileNotFoundException.

The behavior of Assembly.Load has changed since in the .NET5 framework: https://github.com/dotnet/runtime/issues/62522

See my other ticket here, how this error will sho up: https://github.com/serilog/serilog-settings-configuration/issues/407

yankun avatar Jan 04 '24 18:01 yankun