System shutdown when service is already stopped throws error

Request Type: BUG / MINOR
MCEBuddy Version and Type (32bit or 64bit): 2.4.9 2018-03-09
Operating System and Type (32bit or 64bit): Win10x64
Summary of the problem or suggestion:
It looks like you’re not checking to see if the service is running before asking it for a status update (whether or not the information that some operation was pending is correct or not). i.e. the service crashed while performing said pending operation. Maybe an overlooked return code from a prior call or a missing “are you there” status check before invoking UpdatePendingStatus() when you might not be guaranteed to be “during the handling of Start, Stop, Pause, and Continue commands”. Or add System shutdown to the trapped exceptions.

It is not an error to shut down a service that is already shut down. That is the definition of success. The end condition has been acheived. Just with no work, as it was already done.

Error	17-Mar-2018   2:25 PM
Failed to shut down service. The error that occurred was: System.InvalidOperationException: UpdatePendingStatus can only be called during the handling of Start, Stop, Pause and Continue commands.
   at System.ServiceProcess.ServiceBase.RequestAdditionalTime(Int32 milliseconds)
   at MCEBuddy.Service.ServiceModule.StopEngine(Boolean onStop)
   at System.ServiceProcess.ServiceBase.DeferredShutdown().

Steps to replicate the bug:
Open GUI. Stop Service. Shutdown system (or restart). After reboot, Open GUI, examine event log.

Thanks for reporting it, fixed in today’s 2.4.9 BETA build