Extension methods with IConfiguration parameter are ignored
See original GitHub issueWhen you define sink configuration extension method with IConfiguration
parameter that method is ignored. At the same time if you use IConfigurationSection
and specify value in config source, the method is discovered and the parameter is populated. Also, if default value (null) is specified for IConfiguration
parameter all works as exepected as well. I believe the source of the problem lies in the code which filters methods and doesn’t take into account IConfiguration
parameter type: https://github.com/serilog/serilog-settings-configuration/blob/51a4fca7cf125adc717b657afa98ea8db2fddaea/src/Serilog.Settings.Configuration/Settings/Configuration/ConfigurationReader.cs#L351
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Can't add extension method to IConfiguration in .NET Core ...
For some reason, it seems not to come through in intellisense and the compiler nags that a string can't be passed as a...
Read more >Why isn't my ASP.NET Core environment-specific ...
The extension methods take care to make a case-insensitive comparison between the EnvironmentName and the expected string (e.g. "Development" ).
Read more >Configuration in ASP.NET Core
Learn how to use the Configuration API to configure AppSettings in an ASP.NET Core app.
Read more >Serilog logging extension methods
The idea is to ignore all default ASP.NET messages that are there by default and if optionally to override stuff via configuration. I...
Read more >Using AWSSDK.Extensions.NETCore.Setup
NET Core libraries, it adds extension methods to the IConfiguration interface to make getting the AWS configuration seamless. Using AWSSDK.Extensions.NETCore.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Package v3.0.1 has now been released - https://www.nuget.org/packages/Serilog.Settings.Configuration/3.0.1
Thanks for your report !
@MV10 correct, but if that parameter is not assigned default value, the method is not called. Try it yourself.