- .NET 6.0
- RDP Server Windows version: Windows Server 2022 21H2 20348.887
- RDP Client Windows version Windows 10 21H2 19044.1889
- Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
Problem description:
Fake KeyUp events generated when clicing on a WPF application which is running on a remote machine
Actual behavior:
KeyUp event hanler called
Expected behavior:
KeyUp event handler should not be called
Minimal repro:
- create new WPF app
- Add a KeyUp event handler to the MainWindow and add a TextBlock:
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"
KeyUp="UIElement_OnKeyUp">
<Grid>
<TextBlock x:Name="TextBlock" TextWrapping="Wrap" />
</Grid>
</Window>
-
Add the event handler to the code:
private void UIElement_OnKeyUp(object sender, KeyEventArgs e)
{
TextBlock.Text += " " + e.Key + "/" + e.SystemKey;
}
-
Run this application on a remote computer and connect to that computer with RDP.
-
Deactivate the RDP window
-
Activate the RDP window and click on the WPF application
Result:

I'm not pressing any key on the keyboard.
I'm using mstsc to connect to the remote computer. If I'm using a 3rd partry software (mRemoteNG - RDP version = Rdc6) a simialr issue happens, but instead of 3 lines of pressed key, it shows 15 lines... so much more fake keys.
Problem description:
Fake KeyUp events generated when clicing on a WPF application which is running on a remote machine
Actual behavior:
KeyUp event hanler called
Expected behavior:
KeyUp event handler should not be called
Minimal repro:
Add the event handler to the code:
private void UIElement_OnKeyUp(object sender, KeyEventArgs e)
{
TextBlock.Text += " " + e.Key + "/" + e.SystemKey;
}
Run this application on a remote computer and connect to that computer with RDP.
Deactivate the RDP window
Activate the RDP window and click on the WPF application
Result:

I'm not pressing any key on the keyboard.
I'm using mstsc to connect to the remote computer. If I'm using a 3rd partry software (mRemoteNG - RDP version = Rdc6) a simialr issue happens, but instead of 3 lines of pressed key, it shows 15 lines... so much more fake keys.