Open OliaG opened 4 years ago
Hey @OliaG, please let's talk about this so I can get a better understanding of where this performance problem surfaces and how this is a regression from the classic framework!
@Olina-Zhang If possible, can your team please see if they can reproduce this issue and see how big of an impact it is?
@OliaG I think this issue is by design.
There are 19 Properties on Control
with [Localizable(true)]
AccessibleDescription
AccessibleName
Anchor
AutoSize
BackgroundImage
BackgroundImageLayout
Dock
Enabled
Font
Location
Margin
MaximumSize
MinimumSize
RightToLeft
Size
TabIndex
Text
Visible
Padding
They are generally useful for control layouts on a per-local basis, or providing local specific UI customization.
The designer should not add entries to the resx unless the default values are changed. We should check if this is still the case.
With regards to resource file serialization, there are improvements being made to help with the BinaryFormatter
being deprecated as well as the push for AOT/Trimming. I suspect this will have a positive effect on this scenario.
Problem description: Right now switching the Localizable property on control causes a large amount of properties moved to a .resx file. At runtime this is loaded with heavy use of reflection and deserialization which shows up in our performance profiles as the biggest reason for slow startup time. In our scenario all the controls and forms are designed using flexible layout containers that are automatically sized to fit the text. The all-or-nothing approach to localization, however, causes the control locations and sizes to be moved to .resx file as well. This results in unnecessarily high number of resources that we never localize and that also cause unnecessary re-layouts at startup.