The Wayback Machine - https://web.archive.org/web/20210406144551/https://github.com/dotnet/aspnetcore/issues/31561
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

Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions without reflection ? #31561

Open
LLT21 opened this issue Apr 6, 2021 · 0 comments
Open

Comments

@LLT21
Copy link

@LLT21 LLT21 commented Apr 6, 2021

I have tried to compile my .NET 5 bare http server project with Native AOT without reflection. This is possible for a normal http connection, but not for a https connection because in Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions the line of code:

var loggerFactory = listenOptions.KestrelServerOptions?.ApplicationServices.GetRequiredService() ?? NullLoggerFactory.Instance;

that appears twice in this class requires reflection. Could it be changed to:

var loggerFactory = listenOptions.KestrelServerOptions?.ApplicationServices?.GetRequiredService() ?? NullLoggerFactory.Instance;

so that it has the ? after ApplicationServices. In this way I believe the reflection can be avoided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant