Skip to content

WithUnknownTypeResolution breaks Constructor selection rules #51

@schuettecarsten

Description

@schuettecarsten

I have a class that implements these two constructors:

public LoggerFactory(IEnumerable<ILoggerProvider> providers, LoggerFilterOptions filterOptions)
public LoggerFactory(IEnumerable<ILoggerProvider> providers, IOptionsMonitor<LoggerFilterOptions> filterOption)

Given there is a service registration for IEnumerable<ILoggerProvider> and for IOptionsMonitor<LoggerFilterOptions>, but no registration for LoggerFilterOptions. If the container is configured without WithUnknownTypeResolution, everything works fine, the second constructor is selected. But if WithUnknownTypeResolution is used, then the first constructor is choosed, regardless whether the second constructor is fully resolvable or not.

I would expect that unknown type resolution only runs if no constructor matches completely.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions