Description
When Surface Pro sleeps, the SystemEvents.PowerModeChanged event is not raised
Reproduction Steps
SystemEvents.PowerModeChanged += (s, e) => Debug.WriteLine(e.Mode);
Expected behavior
Should print Suspend on Sleep
Actual behavior
Prints 'Suspend' on Desktop
No output on Surface Pro
Regression?
No response
Known Workarounds
Use PowerRegisterSuspendResumeNotification
Configuration
dotnet SDK 10.0.102
Windows 11 (10.0.26200)
x64
Other information
WM_POWERBROADCAST doesn't work for laptops
https://learn.microsoft.com/en-us/windows/win32/power/wm-powerbroadcast
PowerRegisterSuspendResumeNotification is available on Windows 8+ which works as expected:
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registersuspendresumenotification