WinForms freezes when using Alt+Space on Windows 10 Anniversary
Hello all,
I use:
1 - Latest cefsharp master branch 2 - Winforms.Example (x86) 3 - Windows 10 (+ Anniversary update) - I cannot reproduce the issue on Windows 7/8/8.1 4 - Issue is not reproducible with cef simple (including Windows 10). 5 - VS 2013 (Update 4/5) and VS 2015 (Update 2/3) 6 - Issue is 100% reproducible (deterministic).
Observed behaviour is that once using Alt+Space Winforms.Example is no longer responsible. I'm able to reproduce the issue on more then 5 Windows 10 machines.
Thank you in advance for your answer.
Stefan Bozov.
You should discuss the issue at http://magpcss.org/ceforum/viewtopic.php?f=6&t=14479
Thanks a lot.
This problem only appears when settings.MultiThreadedMessageLoop = true (the default). Integrating CEF into the existing message loop is possible, better integration can be obtained using #1748. This method is new and I've not tested in a production environment myself. There are reports of other CEF users implementing the method successfully. Remember that CefSharp is just a wrapper around the CEF framework. You can test the suggested workaround in the CefSharp.WinForms.Example project by changing true to false at https://github.com/cefsharp/CefSharp/blob/cefsharp/53/CefSharp.WinForms.Example/Program.cs#L62
Thank you very much! I'll play with the master.
I have resolved the problem changing the default value in the KeyboardHandler: var result = true; I don’t know if there are any issue, but my application seems ok.
Proper solution/workaround was posted in the mentioned forum link - http://magpcss.org/ceforum/viewtopic.php?p=32766#p32766
I'm going to close this issue as there are valid workarounds and there really isn't a way to fix this in CefSharp directly.
Option 1
Add a MenuStrip to your application, can be invisible. Originally suggested in http://magpcss.org/ceforum/viewtopic.php?p=32766#p32766
This appears to be the easiest option.
Controls.Add(new MenuStrip { Visible = false });
Option 2
Integrate CEF into the WinForms existing message loop as described above in https://github.com/cefsharp/CefSharp/issues/1822#issuecomment-252535727
Sorry for posting in closed issue, but this still is the only real reference to the ALT -> freeze issue.
Same issue happens in WPF. There is a workaround too: extend ChromiumWebBrowser class with following override:
protected override void OnPreviewKeyUp(KeyEventArgs e)
{
if (e.Key == Key.System)
{
e.Handled = true;
}
base.OnPreviewKeyDown(e);
}
(inspired by this: https://stackoverflow.com/questions/54147615/how-to-mark-f10-key-as-handled-in-cefsharp-for-wpf)