question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extension methods with IConfiguration parameter are ignored

See original GitHub issue

When 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:closed
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
tsimbalarcommented, Oct 17, 2018

Package v3.0.1 has now been released - https://www.nuget.org/packages/Serilog.Settings.Configuration/3.0.1

Thanks for your report !

1reaction
andriysavincommented, Oct 14, 2018

@MV10 correct, but if that parameter is not assigned default value, the method is not called. Try it yourself.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found