Closed Metadorius closed 1 year ago
How "native" to class method call expression looks:
Extension methods:
@Metadorius Thanks for the finding, will fix Btw, I am accepting the PRs if you're willing to.
I would love to help, but I am afraid my expertise on this is not enough 😅
That's fine. You are already helping.
fixed now.
Background: I am integrating Serilog in my application. I used your examples with context-based resolution but adapted them to a generic
Microsoft.Extensions.Logging
+ Serilog approach to decouple from Serilog in the business logic code. I got something like this:It works fine on the first registration because string-accepting method is actually a class method and fails on the second one, which is an extension method, because for some reason extension methods in C# behave differently internally compared to regular instance methods and this is not handled by DryIoc
Made.Of
handling code.Non-extension method:
Extension method:
As a result it fails because it gets an unexpected non-constant parameter (being the factory which is the extension method is for)