FindNameScope
is being called once per named component assignment
#15365
Labels
FindNameScope
is being called once per named component assignment
#15365
Describe the bug
Avalonia.Generators.NameGenerator.AvaloniaNameSourceGenerator
generatesInitializeComponent
and invokesFindNameScope
as many times as there are named components within the control.To Reproduce
Name
attribute to name some of the contained controlsInitializeComponent
for the controlExample of generated code:
Expected behavior
The
FindNameScope
method's result can be stored in a variable before each component assignment. If there are no named components, the method should not be invoked at all, and no variable will have to be used for storing its result.Avalonia version
11.0.10
OS
No response
Additional context
The
FindNameScope
method, to my understanding, will always return the same result withinInitializeComponent
when invoked onthis
. This results in redundant invocations of the method, which costs performance upon initializing an instance of the control.The text was updated successfully, but these errors were encountered: