This is a strange issue only in Win8.1.
As we all know, if there is a running application in a machine, there should not be any other behavior against the application when we connect/disconnect/reconnect to this machine by Remote Desktop Connection. However, we found that Win8.1 will fire unload and load events to the WPF application when we close and reconnect to the machine using RDC. And this is an unwanted behavior which may cause error.
Here are the stable reproduce steps:
- Write a WPF application which contains a button and handles the unload and load events of this button.
- Using RDC to connect to a Win8.1 from Win7 for example.
- In the remote desktop, run this WPF app.(a load event will be recorded in a.txt).
- Close the RDC by clicking the 'x'.
- Connect to this Win8.1 again.
- You will see the unload and load events have been fired.
If the WPF app runs in Win7 or Win server 2008, those events will not be fired.
So, I think it is a unwanted behavior in Win8.1. Is that a bug in Win8.1 RDP? Or is that a new feature?