Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure to set the scan code for KEYBDINPUT #33434

Closed
wants to merge 12 commits into from

Conversation

sharwell
Copy link
Member

@sharwell sharwell requested a review from a team as a code owner February 15, 2019 22:44
Copy link
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's it...oh goodness that's subtle.

This call only works when the tests are run as an administrator. For
local testing, the call will always fail because the tests run as a
normal user. For CI testing, the call is simply unnecessary because the
machines are not connected to physical input devices (keyboard/mouse)
that would be otherwise able to interfere with the test sequence.
@sharwell sharwell requested a review from a team as a code owner February 19, 2019 16:38
throw new ExternalException("Sending input failed because input was blocked by another thread.", hresult);
}
}
ResetKeyState(VirtualKeyCode.LCONTROL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before doing the reset, is it worth checking if the key is still active, so we can know if we're leaking modifier keys somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not able to find a leak.

default:
Debug.WriteLine($"ERROR: Encountered illegal input type: {input.Type}");
break;
// Slight delay on Esc to ensure the Ctrl key isn't registered as down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to spin until it's not? That'll doubly help if it turns out there's a deeper issue, because then we'll see hangs in a place where we'll understand what's up.

Copy link
Member

@jasonmalinowski jasonmalinowski Feb 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Also maybe link to a tracking bug? Since it's not obvious to me why Escape is more special than any other modifier here. Yes, it has the added affect of launching explorer, but Ctrl+any other letter may invoke random VS commands which will confuse us just as much.)

Copy link
Member Author

@sharwell sharwell Feb 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ctrl+Esc is handled by the DWM, not Visual Studio. I couldn't find any evidence that the Ctrl key state is latching inside Visual Studio. The same cannot be said when pairing keyboard and mouse handling inside the IDE.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not able to reproduce this locally even with high-speed uninterrupted toggling of Ctrl and Esc in thousands of iterations, so I haven't found any reason to believe a specific spin mechanism would be effective in the scenario.

using Microsoft.CodeAnalysis.Serialization;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;

#if VALIDATE_CHECKSUM
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all the fancy conditional compilation? I assume we'd be fixing this ASAP?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all the fancy conditional compilation?

It excludes the implementation helper from release builds.

I assume we'd be fixing this ASAP?

Definitely hoping we do. It seems like a serious issue.


if (inputBlocked)
{
IntegrationHelper.UnblockInput();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any guess if this was causing problems for us?

Copy link
Member Author

@sharwell sharwell Feb 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing conclusive. I eliminated it simply so the integration test runs are a closer match to the state when devs run the tests. This one has a commit message with rationale for the change.

@jasonmalinowski jasonmalinowski dismissed their stale review February 19, 2019 18:46

PR was changed significantly, and a few small questions/suggestions now.

@sharwell
Copy link
Member Author

Superseded by #33524

@sharwell sharwell closed this Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants