You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently XamlX emitted a huge !CompiledAvaloniaXaml.!XamlLoader.TryLoad which puts all xaml files into a single method, which leads to all generated code being preserved after trimming, even if some of those xaml files were not being used.
For example, the !XamlLoader.TryLoad for Avalonia.Themes.Fluent is:
which leads to all those compiled xaml code being kept even if the user only use a Button in the app.
To make the loading process on demand, instead of emitting all things in a single TryLoad, emitting TryLoad_{uri} is a more properate choise. In this case, the TryLoad for avares://Avalonia.Themes.Fluent/Accents/AccentColors.xaml will become:
To achieve trimming compatibility, we also need to introduce an attribute which save related types using string or Type with DynamicallyAccessedMembers, so that the trimmer can figure out which types are being used during compilation.
This is a breaking change, I would like to see the change landing before 11.0 GA getting released.
The text was updated successfully, but these errors were encountered:
Another problem would be FluentTheme itself referencing all of the styles directly.
I wonder if IL linker supports weak references, so we could generate something like this:
Currently XamlX emitted a huge
!CompiledAvaloniaXaml.!XamlLoader.TryLoad
which puts all xaml files into a single method, which leads to all generated code being preserved after trimming, even if some of those xaml files were not being used.For example, the
!XamlLoader.TryLoad
forAvalonia.Themes.Fluent
is:which leads to all those compiled xaml code being kept even if the user only use a
Button
in the app.To make the loading process on demand, instead of emitting all things in a single
TryLoad
, emittingTryLoad_{uri}
is a more properate choise. In this case, theTryLoad
foravares://Avalonia.Themes.Fluent/Accents/AccentColors.xaml
will become:To achieve trimming compatibility, we also need to introduce an attribute which save related types using
string
orType
withDynamicallyAccessedMembers
, so that the trimmer can figure out which types are being used during compilation.This is a breaking change, I would like to see the change landing before 11.0 GA getting released.
The text was updated successfully, but these errors were encountered: