Skip to content

SystemEvents.PowerModeChanged is not raised on suspend/resume on Surface Pro #123773

@molesmoke

Description

@molesmoke

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions