Skip to content

InputKeyboardSource.GetKeyStateForCurrentThread is often wrong #4017

@stevenbrix

Description

@stevenbrix

Describe the bug

the InputKeyboardSource.GetKeyStateForCurrentThread is often wrong and reporting keys as being Locked when they aren't

InputKeyboardSourceRepro.zip

Steps to reproduce the bug

  1. download attached zip and build/launch project
  2. observe text block saying "Unclicked"
  3. click the button
  4. see text block change from "Unclicked" to "Locked"

play around with the project and you'll notice that it's inconsistent. so if the above steps don't immediately cause a repro, just try a few more times and you should hit it

Expected behavior

the textblock to accurately reflect the state of the key

Screenshots

input.keyboard.repro.mp4

NuGet package version

Windows App SDK 1.4.3: 1.4.231115000

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions