-
Couldn't load subscription status.
- Fork 1.1k
Fixing runtime crash if an application contains ToolStripMenuItem with configured shortcut and launched in other locales.
#8401
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
Conversation
|
Important notes:
A few suggestions:
|
ToolStripMenuItem with configured shortcut and launched in other locales.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Let's say there is a .NET 7 app with "Strg+D" shortcut in resources, which is later updated to .NET 8 with this fix. As I understand the app will crash on runtime and designer won't load the form. I'm not sure it will be clear for developers what exactly needs to be changed in order to fix it. Is it possible to provide more details in this case? Maybe a breaking change page in docs could be useful?
- Does it also fix scenario from #5036?
src/System.Windows.Forms/src/System/Windows/Forms/KeysConverter.cs
Outdated
Show resolved
Hide resolved
|
What happens if a NET 8application is retargetted to NET7 in VS? |
Yes, an error would look like this:
Yes, we could handle this case and throw an exception with a detailed message. Also, we can modify the docs.
I guess, it looks like the reason is the same.
It depends on the user's locale. For example, if the user has |
src/System.Windows.Forms/src/System/Windows/Forms/KeysConverter.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to this change we could add a custom TypeConverter to the designer to handle localization for downlevel versions of the framework.
src/System.Windows.Forms/src/System/Windows/Forms/KeysConverter.cs
Outdated
Show resolved
Hide resolved
8f01c73 to
dffcbbd
Compare
|
I've decided to rework PR to support provided culture in ConvertFrom and ConvertTo methods. According to a comment (#2886 (comment)) it was really broken. And it works as expected, the bug has gone but localization in runtime is still working. |
dffcbbd to
89aa7ae
Compare
src/System.Windows.Forms/src/System/Windows/Forms/KeysConverter.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/KeysConverter.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/KeysConverter.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/KeysConverter.cs
Outdated
Show resolved
Hide resolved
89aa7ae to
2b5ef42
Compare
src/System.Windows.Forms/src/System/Windows/Forms/KeysConverter.cs
Outdated
Show resolved
Hide resolved
2b5ef42 to
d90cc7f
Compare
|
Maybe we should merge PR #8485 with this? |
|
Are the keys serialized to their non-localized values in the designer code? What happens if the translation changes? Can a form be designed okay between culture changes? |
Localized Forms serialize into resx for the properties that are language dependent. May be i didn't get your question. |
d075426
94972f2 to
d075426
Compare
2.Scenario:
|
Our app uses the |
I don't see any other controls with |
d075426 to
8f38d3b
Compare
8f38d3b to
d89f52d
Compare
@Tanya-Solyanik |
This is strange. When I set Localizable property on the form to true and Language to de-DE, Form1.de-DE.resx is created |
Sorry, I initially misunderstood the steps, now Form1.de-DE.resx is created, and I confirmed that results are the same as with manually created resource file. |




Fixes #2886
Proposed changes
cultureparameter inConvertFromandConvertTomethods.KeysConverterbecomes more independent and doesn't contain the logic of choosing the "right" locale.Customer Impact
Regression?
Risk
ShortcutKeys(e.g. Strg for de-DE) are crashed.ShortcutKeysEditorseems inconsistent due toKeysConverterreceivingCultureInfo.CurrentCulturewhileShortcutKeysUIis localized withCultureInfo.CurrentUICulture.Screenshots
Before
After
Test methodology
Test environment(s)
.NET SDK:
Version: 8.0.100-alpha.1.22512.5
Commit: 1b80461e45
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
Microsoft Reviewers: Open in CodeFlow