Skip to content

Multilanguage .NET 5 Winforms app crashes on French Windows, related to Del shortcut key #5036

@xpouyat

Description

@xpouyat
  • .NET Core Version:
    .Net 5.0.6

  • Have you experienced this same bug with .NET Framework?:
    No

Problem description:

There an issue with a new multilanguage .NET 5 winforms app when deployed and run on a French Windows OS. The published App crashes at start on the French Windows with error:
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException: Requested value ‘Del’ was not found.

The issue seems related to the shortcut key “Del”. On the French Windows, this key is named differently (“Suppr”) and that may be the root of the issue.
Strangely, other keys like “End” are rejected by designer in Visual Studio, telling “Property value is not valid”. But the no such message is displayed for the “Del” key.

Expected behavior:
Expected: No crash on French Windows when running the app.

Minimal repro:

  • On a English Windows, create a new .NET 5 Winforms app with latest Visual Studio 2019 (Version 16.10.0)
  • Select the mainform and set Localizable property to True
  • Add a ContextMenuStrip control and add an entry “test” in it. Associate this entry to the “Del” key, by setting the ShortcutKeys to “Del”.
  • Publish the app to a local folder
  • Run the published app on a French Windows.
  • The UI does not show, no error is displayed on screen.
  • In the event viewer of the French Windows, there is an error :
    Application: WinFormsApp9.exe
    CoreCLR Version: 5.0.621.22011
    .NET Version: 5.0.6
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.ArgumentException: Requested value ‘Del’ was not found.
    at System.Enum.TryParseByName(RuntimeType enumType, String originalValueString, ReadOnlySpan1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt64& result) at System.Enum.TryParseInt32Enum(RuntimeType enumType, String originalValueString, ReadOnlySpan1 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)
    at System.Windows.Forms.KeysConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
    at System.ComponentModel.TypeConverter.ConvertFromInvariantString(String text)
    at System.Resources.Extensions.DeserializingResourceReader.DeserializeObject(Int32 typeIndex)
    at System.Resources.Extensions.DeserializingResourceReader._LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
    at System.Resources.Extensions.DeserializingResourceReader.LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
    at System.Resources.Extensions.DeserializingResourceReader.ResourceEnumerator.get_Entry()
    at System.Resources.Extensions.DeserializingResourceReader.ResourceEnumerator.get_Current()
    at System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
    at System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
    at System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
    at System.ComponentModel.ComponentResourceManager.ApplyResources(Object value, String objectName, CultureInfo culture)
    at System.ComponentModel.ComponentResourceManager.ApplyResources(Object value, String objectName)
    at WinFormsApp9.Form1.InitializeComponent() in C:\Users\xpouyat\source\repos\WinFormsApp9\WinFormsApp9\Form1.Designer.cs:line 44
    at WinFormsApp9.Form1…ctor() in C:\Users\xpouyat\source\repos\WinFormsApp9\WinFormsApp9\Form1.cs:line 17
    at WinFormsApp9.Program.Main() in C:\Users\xpouyat\source\repos\WinFormsApp9\WinFormsApp9\Program.cs:line 20

Sample project : WinFormsApp9.zip

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions