I found a solution for the problem which triggers TV Service Stop() on receiving the pre-shutdown message and lets the Windows Service Control Manager know that the tvservice has stopped. The code is based on this blog. I reopened the MP1-3172 issue in JIRA and provided a branch in github (https://issues.team-mediaportal.com...ice_ignores_shutdown_(reopened)/MediaPortal-1)....The MP1-3172 fix makes TVService react on the Windows pre-shutdown message and let it stop the TVController and all TVServer plugins cleanly. Before they were killed by the Windows Service Manager which led to exceptions and error messages in the logs. But: Though the TVService shuts down cleanly now (seen from MP's view), Windows does not notice that the TVService has been stopped and therefore now waits for 10 seconds to get a stop notification (gives an error in the System event log) and only then continues its shutdown progress. I have found no way so far how to signal Windows that the TVService has been stopped from .NET managed code.
So the options are:
- Revert the MP1-3172 fix and ignore the pre-shutdown message (will bring back exceptions and error logs but shuts down 10 sec faster)
- Keep everything as it is now (slower shutdown and error in System event log)
- Find a way to stop TVService cleanly and under control of the Windows Service manager
The latter should be achieved, so @Developers who can help?