Search stops working for “Entire Solution”

后端 未结 28 1281
温柔的废话
温柔的废话 2020-12-02 03:30

Somehow Visual Studio search has stopped working for me. Anytime I search \"Entire Solution\" for some text I get this result:

Find all \"[Whatever I

28条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 04:04

    Bug source

    This is neither Visual Studio nor Windows related bug. In fact, the bug is in your keyboard! Many keyboards from different vendors have been reported to be buggy.

    Problem

    If you press Ctrl+Break and release Ctrl first, then Break gets stuck on a buggy keyboard. If you ever pressed Ctrl+Break the "wrong" way, you will have this problem with search being interrupted.

    Details

    According to scan code specifications, Break and Ctrl+Break are special. They send "make" (press) AND "break" (release) scan codes the moment you press Break. They send nothing when you release Break. The buggy keyboard will send the following sequence:

    1. Ctrl "make" scan code
    2. Ctrl+Break "make" scan code
    3. Ctrl "break" scan code
    4. Pause "break" scan code

    That is, Ctrl+Break is never released, but instead Pause is released.

    Reproduction

    You could for example use old good Spy++ from Visual Studio tools. Attach it to anything, for example Windows notepad, and monitor messages (I suggest that you select only keyboard messages). Press Ctrl+Break, releasing Ctrl first. Check the output from Spy++. You will see the sequence I shown in Details section.

    I have tried two different keyboards on the same computer. Logitech K120 has the bug while some other Mitsumi keyboard behaves according to specifications and does not have the bug.

    If you think about it, it's easy to understand that correct behavior needs special case handling, while buggy behavior is naive. This is why many different keyboards can be buggy.

    Solution

    Replace your keyboard :)

    Workaround

    You simply need to press Ctrl+Break, paying attention to releasing Break first. It doesn't matter which application is active.

提交回复
热议问题