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

Culture de-DE issue with DataGrid #913

Closed
Lakritzator opened this issue Jun 11, 2019 · 3 comments · Fixed by #919
Closed

Culture de-DE issue with DataGrid #913

Lakritzator opened this issue Jun 11, 2019 · 3 comments · Fixed by #919
Assignees
Labels
Bug Product bug (most likely)
Milestone

Comments

@Lakritzator
Copy link

  • .NET Core Version: 3.0.100-preview7-012343

  • Windows version: Windows 10 1903 & Windows 7 (6.1 build 7601 Service Pack 1)

  • Does the bug reproduce also in WPF for .NET Framework 4.8?: No

Problem description:
When the UI Culture is de-DE, any interaction (wheel, click) with a DataGrid will throw an exception (see below). This is related to #684

Actual behavior:

Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Requested value 'BILDAUF' was not found.
   at System.Enum.TryParseByName(RuntimeType enumType, String originalValueString, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt64& result)
   at System.Enum.TryParseInt32Enum(RuntimeType enumType, String originalValueString, ReadOnlySpan`1 value, Int32 minInclusive, Int32 maxInclusive, Boolean ignoreCase, Boolean throwOnFailure, TypeCode type, Int32& result)
   at System.Enum.TryParse(Type enumType, String value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
   at System.Windows.Input.KeyConverter.GetKey(String keyToken, CultureInfo culture)
   at System.Windows.Input.KeyConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object source)
   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.OnMouseWheelThunk(Object sender, MouseWheelEventArgs e)
   at System.Windows.Input.MouseWheelEventArgs.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)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Window.ShowHelper(Object booleanBox)
   at System.Windows.Window.Show()
   at System.Windows.Window.ShowDialog()
   at Caliburn.Micro.WindowManager.ShowDialog(Object rootModel, Object context, IDictionary`2 settings)

Expected behavior:
No exception

Minimal repro:
https://github.com/Lakritzator/WpfDataGridCultureBug
In fact this is just a "dotnet new wpf", making sure the Thread.CurrentThread.CurrentUICulture is set to the "de-DE" culture, and change the grid in MainWindow.xaml to DataGrid.
Run the example, and use the scrollwheel (or click) on the DataGrid.

I was going to supply a PR, but I'm confused! In #796 the translations are reverted and seem to be okay.

But in the final file https://github.com/dotnet/wpf/blob/master/src/Microsoft.DotNet.Wpf/src/PresentationFramework/Resources/xlf/Strings.de.xlf#L2952 there are still translations which probably cause the issue.

And somehow I don't know where the changes come from...

Maybe @ryalanms knows what happened here.

@clairernovotny
Copy link
Member

clairernovotny commented Jun 11, 2019

I wonder if this is related? NuGetPackageExplorer/NuGetPackageExplorer#716

I'm getting tons of WPF exceptions in Preview 6, but none from English. German, Russian, Spanish, Japanese, etc.

clairernovotny pushed a commit to NuGetPackageExplorer/NuGetPackageExplorer that referenced this issue Jun 11, 2019
@Lakritzator
Copy link
Author

@onovotny Last time we checked the translations there seemed to be wrong values for German only. The few errors I saw mentioned in your issue were certainly due to a German culture (strg is ctrl in German).

Maybe we overlooked some others, or they all use a German keyboard 😉

Lakritzator added a commit to dapplo/Dapplo.Microsoft.Extensions.Hosting that referenced this issue Jun 11, 2019
@grubioe grubioe added Bug Product bug (most likely) urgent status: This issue needs immediate attention labels Jun 11, 2019
@grubioe grubioe assigned grubioe and ryalanms and unassigned grubioe Jun 11, 2019
@grubioe grubioe removed the urgent status: This issue needs immediate attention label Jun 11, 2019
@grubioe grubioe added this to the Preview milestone Jun 11, 2019
@Lakritzator
Copy link
Author

Lakritzator commented Jun 13, 2019

@ryalanms Thanks for fixing this!! 👍

In dotnet core 3.0.100-preview7-012393 the fix doesn't seem to be available yet.

I don't want to ask when it will be available as I'm sure it will come some day, but is there any way to see when this (or fixes for other issues) is in the dotnet core sdk? I asked this before in other issues, never got an answer, how can we see what is in a certain sdk?

Lakritzator added a commit to dapplo/Dapplo.Dopy that referenced this issue Jun 14, 2019
southernwind added a commit to southernwind/WpfDefaultTemplateCreator that referenced this issue Jul 23, 2019
.NET Core3.0-preview6時点では以下の問題がまだ発生しているため。
dotnet/wpf#913
@ghost ghost locked as resolved and limited conversation to collaborators Apr 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Product bug (most likely)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants