Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support nullable as optional dependency #143

Closed
skarllot opened this issue Nov 19, 2023 · 1 comment
Closed

Support nullable as optional dependency #143

skarllot opened this issue Nov 19, 2023 · 1 comment

Comments

@skarllot
Copy link
Contributor

I'm getting problems with optional dependencies as defined by LoggerFactory and ConsoleLoggerProvider.

public LoggerFactory(IEnumerable<ILoggerProvider> providers, IOptionsMonitor<LoggerFilterOptions> filterOption, IOptions<LoggerFactoryOptions>? options)
public ConsoleLoggerProvider(IOptionsMonitor<ConsoleLoggerOptions> options, IEnumerable<ConsoleFormatter>? formatters)

The source generator generates the following invalid code:

// ...
        private System.Collections.Generic.IEnumerable<Microsoft.Extensions.Logging.Console.ConsoleFormatter>?? _IEnumerable_ConsoleFormatter;
// ...
            if (type == typeof(System.Collections.Generic.IEnumerable<Microsoft.Extensions.Logging.Console.ConsoleFormatter>?)) return this.GetService<System.Collections.Generic.IEnumerable<Microsoft.Extensions.Logging.Console.ConsoleFormatter>?>();
// ...
This was referenced Nov 19, 2023
@skarllot skarllot changed the title Support optional dependency Support nullable as optional dependency Nov 21, 2023
@pakrym
Copy link
Owner

pakrym commented Nov 22, 2023

Fixed in #147

@pakrym pakrym closed this as completed Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants