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
Windows app crashes when pressing "Insert" key. #94502
Comments
It doesn't appear to matter what the application is: just pressing Insert in a Windows app crashes, even if a text field isn't focused. |
I still can't trigger it somehow... Can you investigate it for me? Specifically, can you try lifting the limitation in #93897? |
Sure. It might have to do with the fact that I access the Windows machine over remote desktop (it's a cloudtop machine). |
It looks like I can't reproduce this when using remote desktop and a macOS laptop as the host (it's hard to make an "Insert" key press there anyhow, but I tried a virtual keyboard, along with Fn-Ctrl-Enter). It may be a combination of a Linux host and/or the physical keyboard I was using. I'll try again on Monday when I'm in the office. |
Do we need to do some key input fuzzing here? I wonder if we should have a test that pumps lots of random keycodes and sees if we can get crashes? |
I think @gspencergoog has tested and concluded that this is only happening using a remote from a specific platform. |
I've done some testing, but I'm not done yet: I'd like to find out the root cause. In any case, it seems like some fuzzing might not be a bad idea: we do have some weird cases where crashes are occuring, and I would like to feel comfortable that pressing a key can't crash a (non-debug) app. |
This happens to me with the SHIFT key and not on remote desktop, but just normally on Windows 10 with Flutter 3.3. I'm building and using the app for Windows, not android, ios or anything else, and not via a remote desktop either, but natively on the same computer that I'm coding on. This was not happening prior to Flutter 3.3 REPRO STEPS: Open a command prompt, type: Then add Then run the app in debug, focus the textfield and press the right and left shift a couple of times and then boom:
When running a release build of the app, it will literally crash the app if I use the shift keys. |
@darkalfx I'm unable to reproduce this anymore on master. Can you please try it on the master channel and see if you still have this problem? If you do, then please post the output of |
@gspencergoog Still happening on my side
Flutter doctor:
|
Just realize that this issue is P4. So I don't expect this to be fixed in the near future. |
P4 is our default priority for bugs that we intend to work on. |
Same thing happening with me as well on flutter 3.3.2 on window. When the exception was thrown, this was the stack |
I'm having same error, but my problem are in Android TV, using the remote, when i press "OK". I tried with some different hardware. This issue occurs in debug and installed Another exception was thrown: A KeyDownEvent is dispatched, but the state shows that the physical key is already pressed. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in [✓] Flutter (Channel master, 3.5.0-1.0.pre, on Ubuntu 22.04.1 LTS 5.15.0-48-generic, locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) [✓] Chrome - develop for the web [✓] Linux toolchain - develop for Linux desktop [✓] Android Studio (version 2021.2) [✓] VS Code [✓] Connected device (3 available) [✓] HTTP Host Availability • No issues found! |
Honestly, this is a critical bug, it prevents Windows app from using any form of text inputs as it crashes the app. The only solution is to rollback to an earlier Flutter version. (Earlier than 3.3) |
The same issue happens to me when I press the Shift key. Windows 10 Flutter version is 3.3.9
|
The same issue. Windows 10 Flutter version is 3.3.10. ======== Exception caught by services library ======================================================
The following assertion was thrown during a platform message callback:
A KeyRepeatEvent is dispatched, but the state shows that the physical key is not pressed. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyRepeatEvent#f6ca2(physicalKey: PhysicalKeyboardKey#700e1(usbHidUsage: "0x000700e1", debugName: "Shift Left"), logicalKey: LogicalKeyboardKey#00102(keyId: "0x200000102", keyLabel: "Shift Left", debugName: "Shift Left"), character: null, timeStamp: 197:14:30.651642)
'package:flutter/src/services/hardware_keyboard.dart':
Failed assertion: line 432 pos 16: '_pressedKeys.containsKey(event.physicalKey)' |
The same issue. Windows 10 Flutter version is 3.3.10.
|
Instead of saying 'same issue', as long as it doesn't contain relevant info like an older flutter version affected by the issue, or a different but similar error, just react with 👍 |
Noticed the behaviour after the 3.13 release. While I am unsure about any flutter releases before 3.3 while on 3.10, I didn't experience this issue. And it seems to happen for me with the alt-left key: [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/services/hardware_keyboard.dart': Failed assertion: line 471 pos 16: '_pressedKeys.containsKey(event.physicalKey)': A KeyUpEvent is dispatched, but the state shows that the physical key is not pressed. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#84f93(physicalKey: PhysicalKeyboardKey#f0183(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#e5ce6(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 5:25:20.780332, synthesized)
hardware_keyboard.dart:471
|
I confirm, the problem persists.
While debugging my application, I accidentally pressed the combination 'Ctrl + NumLock' and long exceptions were thrown:
After this exception has been thrown, it is no longer possible to delete text from the TextFields, only to insert it. The problem occurs anywhere in the app, even if no TextField is in the focus state. Can anyone confirm that creating a default flutter and pressing Ctrl + NumLock causes problems in the app? |
Let me share with you what I think has caused this error, with different versions of Flutter/Dart and different projects: I am in the editor, I press the DEBUG button. While compiling, for example, I go to another application (or even in the same editor) and start typing on the keyboard, anything. Then, the compiler finishes and immediately my APP window appears, the usual... but I have continued to use the keyboard because I didn't notice the quick change of application focus.... from where I was typing to the APP in DEBUG mode... then the error appears: A KeyDownEvent is dispatched, but the state shows that the physical key is already pressed. ... Then all attempts to use the keyboard in the APP I am debugging, produce error. I must close the app and restart my debug being careful not to use the keyboard (nor the tackpad) at that time. Apparently, it has something to do with the initialization of the keyboard/mouse at the start of debugging. This error, of course, I have not been able to reproduce when I am not debugging. |
doctor --verbose ======== Exception caught by services library ====================================================== Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause. When the exception was thrown, this was the stack:
|
When I run a Windows app, and press "Insert" using the master channel, it crashes the app.
When it crashes, in the (Dart) exception, it gives the key event as:
Which is weird to me, since it isn't the NumLock key, it's the Insert key.
The keycode for Insert should be 0x2d, not 0xff.
It's might be crashing because it looks at "NumLock" and thinks it needs to synchronize modifiers, but no modifier flags are set (because it's not a modifier).
Reproduction steps:
flutter create --platform=windows foo
cd foo
flutter run -d windows
I was able to repro this with the b865e23 master build.
cc @dkwingsmt
The text was updated successfully, but these errors were encountered: