Application.SessionEnding event not invoked when ACPI shutdown button pressed and display turned off

Viewed 56

I've been developing a WPF application that targets the .NET Framework 4.5.1. It is running on Windows 10. The machine has an external ACPI shutdown button. When pressed Windows starts the shutdown process.

Part of the code attaches to the Application.SessionEnding event and when invoked does some processing. The first line of code in the attached delegate logs a line something similar to: "Received PowerOff" etc. The logline is always present when I press the shutdown button while the display is turned on and Windows starts the shutdown sequence. But if the display is off, when I press the shutdown button it only turns the display on and nothing else happens. The shutdown sequence is not invoked by Windows.

Did someone else experience this behavior? Is there any documentation or article about it? What are my options? I want Windows always to invoke shutdown sequence on button press. Not only when the display is turned on.

0 Answers
Related