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

Unhandled exception – provide the application access to the exception details. #63

Open
DaveSenn opened this issue Mar 12, 2018 · 2 comments

Comments

@DaveSenn
Copy link

Hi Martin

If I understood the code correctly, the library is catching unhandled exceptions and then calls Win32ServiceHost.ReportServiceStatus without throwing the exception?

Is there a way to notify the application about such an exception?
…So that the application for example can write a last “emergency” log statement bevor it exits.
Maybe an event similar to AppDomain.CurrentDomain.UnhandledException?

Btw.
Really cool library, thanks for sharing it.

@dasMulli
Copy link
Owner

I've already heard feedback about not really being able to debug exceptions. The problem with throwing is that it breaks the connection to windows' service management system.

I'm open to suggestions for how to handle this best.

The netfx ServiceBase reports to the event log, which also isn't available in .net core yet, it will be part of the windows compatibility pack in the .net core 2.1 timeframe. This also contains ServiceBase for .net core which kind of obsoletes part of this library (except for service creation/update/delete).

Two options:

  • Wait until .NET Core 2.1 release and write to the event log on windows (the compatibility pack should be available for netstandard2.0 but released alongside .NET Core 2.1). I don't want to create another PInvoke wrapper over the event log APIs, esp. since there is one coming in the compatibility pack.
  • Provide a hook on the service host like events, IExceptionReporter or similar.

@DaveSenn
Copy link
Author

Having an entry in the event log (with .Net Core 2.1) would work for me.

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