I am developing a WPF
App and getting a very weird problem:
I use SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
to detect the screen lock event of the computer. The code works well in Windows 10
. But crashes in Windows 8
. The error window I got was "You App has stopped working" without any exception code. I tried it on other Windows 10
and other Windows 8
and got the same results. Any ideas?