Wpf: [Crash - Preview 6] Unbekannte ModifierKeys "STRG"

Created on 19 Jun 2019  路  3Comments  路  Source: dotnet/wpf

Error occur only on Preview 6, Preview 5 works fine

Version Used:
SDK 3.0.100-preview6-012264

Steps to Reproduce:

  1. Start or debug a WPF-Application under Windows with German language
  2. Use a control that check for modifier keys

    • e.g. a control from NuGet package OxyPlot or

    • A control from NuGet package WPF Toolkit

Expected Behavior:

  • Don't translate modifier Keys
  • and don't crash

Actual Behavior:
Crash with Unbekannte ModifierKeys "STRG".

   at System.Windows.Input.ModifierKeysConverter.GetModifierKeys(String modifiersToken, CultureInfo culture) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Input/ModifierKeysConverter.cs:line 192
   at System.Windows.Input.ModifierKeysConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object source) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Input/ModifierKeysConverter.cs:line 90
   at System.Windows.Input.KeyGestureConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object source)
   at System.ComponentModel.TypeConverter.ConvertFromInvariantString(String text)
   at System.Windows.Input.KeyGesture.CreateFromResourceStrings(String keyGestureToken, String keyDisplayString)
   at System.Windows.Input.KeyGesture.AddGesturesFromResourceStrings(String keyGestures, String displayStrings, InputGestureCollection gestures)
   at System.Windows.Input.ApplicationCommands.LoadDefaultGestureFromResource(Byte commandId)
   at System.Windows.Input.RoutedCommand.GetInputGestures()
   at System.Windows.Input.RoutedCommand.get_InputGesturesInternal()
   at System.Windows.Input.CommandBindingCollection.FindMatch(Object targetElement, InputEventArgs inputEventArgs)
   at System.Windows.Input.CommandManager.TranslateInput(IInputElement targetElement, InputEventArgs inputEventArgs)
   at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.RouteItem.InvokeHandler(RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.EventRoute.InvokeHandlers(Object source, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Win32/HwndWrapper.cs:line 340
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Win32/HwndSubclass.cs:line 498
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs:line 104
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs:line 37
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 1448
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Win32/HwndSubclass.cs:line 396
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 2316
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 374
   at System.Windows.Threading.Dispatcher.Run() in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 333
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at PowerCalculator.App.Main()

All 3 comments

Hi @TobiasSekan. For Preview 6, add @nguerrera's workaround to the project (.csproj file):

<PropertyGroup>
  <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>

This is also fixed by #919 which is available in the nightly build. Thanks.

Hello,

<PropertyGroup>
  <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>

this dosen't work for me :(

crash with System.NotSupportedException: "Unbekannte ModifierKeys "STRG"." is still present on preview 6

Another crash
"Requested value 'BILDAUF' was not found."

   at System.Enum.TryParseByName(RuntimeType enumType, String originalValueString, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt64& result) in /_/src/System.Private.CoreLib/shared/System/Enum.cs:line 774
   at System.Enum.TryParseInt32Enum(RuntimeType enumType, String originalValueString, ReadOnlySpan`1 value, Int32 minInclusive, Int32 maxInclusive, Boolean ignoreCase, Boolean throwOnFailure, TypeCode type, Int32& result) in /_/src/System.Private.CoreLib/shared/System/Enum.cs:line 533
   at System.Enum.TryParse(Type enumType, String value, Boolean ignoreCase, Boolean throwOnFailure, Object& result) in /_/src/System.Private.CoreLib/shared/System/Enum.cs:line 382
   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) in /_/src/System.Private.CoreLib/shared/System/Enum.cs:line 327
   at System.Windows.Input.KeyConverter.GetKey(String keyToken, CultureInfo culture) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Input/KeyConverter.cs:line 220
   at System.Windows.Input.KeyConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object source) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Input/KeyConverter.cs:line 90
   at System.Windows.Input.KeyGestureConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object source)
   at System.ComponentModel.TypeConverter.ConvertFromInvariantString(String text)
   at System.Windows.Input.KeyGesture.CreateFromResourceStrings(String keyGestureToken, String keyDisplayString)
   at System.Windows.Input.KeyGesture.AddGesturesFromResourceStrings(String keyGestures, String displayStrings, InputGestureCollection gestures)
   at System.Windows.Input.ComponentCommands.LoadDefaultGestureFromResource(Byte commandId)
   at System.Windows.Input.RoutedCommand.GetInputGestures()
   at System.Windows.Input.RoutedCommand.get_InputGesturesInternal()
   at System.Windows.Input.CommandBindingCollection.FindMatch(Object targetElement, InputEventArgs inputEventArgs)
   at System.Windows.Input.CommandManager.TranslateInput(IInputElement targetElement, InputEventArgs inputEventArgs)
   at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.RouteItem.InvokeHandler(RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.EventRoute.InvokeHandlers(Object source, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Win32/HwndWrapper.cs:line 340
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Win32/HwndSubclass.cs:line 498
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs:line 104
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs:line 37
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 1448
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Microsoft.DotNet.Wpf/src/shared/MS/Win32/HwndSubclass.cs:line 396
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 2316
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 374
   at System.Windows.Threading.Dispatcher.Run() in /_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs:line 333
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at PowerCalculator.App.Main()

If you want to try out daily builds take a look here, otherwise you could also try setting your resource culture to english during startup (CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");) until preview 7 is released.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stevenbrix picture stevenbrix  路  3Comments

imanushin picture imanushin  路  3Comments

poke picture poke  路  3Comments

Normandy picture Normandy  路  3Comments

daniel-white picture daniel-white  路  3Comments