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

Invalid/Outdated ASP.NET Core sample #309

Open
plachor opened this issue Oct 27, 2022 · 1 comment
Open

Invalid/Outdated ASP.NET Core sample #309

plachor opened this issue Oct 27, 2022 · 1 comment

Comments

@plachor
Copy link

plachor commented Oct 27, 2022

Hi, in your sample sections there is a template how to setup Serilog with ASP. In this sample you suggest to log clean disposal of host (which would be great to do):
https://github.com/serilog/serilog-aspnetcore/blob/dev/samples/Sample/Program.cs#L22

However in case of graceful shutdown you are not guaranteed that this code will ever be executed. Once host completes disposal it will terminate process in parallel most of time not reaching that line of code. In order to make it work every time you would need hook within those extensions methods from ASP or to add your own solution I believe.

Additionally you might update this template to use asynchronous overloads. As main can return Task now.

@plachor plachor added the bug label Oct 27, 2022
@nblumhardt
Copy link
Member

Once host completes disposal it will terminate process in parallel most of time not reaching that line of code.

I haven't observed this - any pointer to where it's documented or implemented? (Is this possibly an issue under IIS or something like that?)

@nblumhardt nblumhardt added discussion and removed bug labels Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants