Skip to content

Commit

Permalink
docs: Align __LinkerHints class name
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Nov 30, 2022
1 parent 9c066b6 commit e1bcd75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/articles/uno-development/Uno-UI-XAML-ResourceTrimming.md
Expand Up @@ -13,12 +13,12 @@ In order to determine what is actually used by the application, the Uno Platform
In order to prepare the linking pass:
- The tooling determines the presence of the `UnoXamlResourcesTrimming` msbuild property
- During the source generation, the tooling generates a `__LinkerHints` class, which contains a set of properties for all `DependencyObject` inheriting classes.
- The source generation creates XAML Resources and Bindable Metadata code that conditionally uses those classes behind `LinkerHints` properties.
- The tooling also embeds an ILLinker substitution file allowing the linker to unconditionally remove the code that conditionally references those properties. For instance, for `LinkerHints.Is_Windows_UI_Xaml_Controls_Border_Available`, any block of `if (LinkerHints.Is_Windows_UI_Xaml_Controls_Border_Available)` will be removed when the `--feature Is_Windows_UI_Xaml_Controls_Border_Available false` parameter is provided to the linker.
- The source generation creates XAML Resources and Bindable Metadata code that conditionally uses those classes behind `__LinkerHints` properties.
- The tooling also embeds an ILLinker substitution file allowing the linker to unconditionally remove the code that conditionally references those properties. For instance, for `__LinkerHints.Is_Windows_UI_Xaml_Controls_Border_Available`, any block of `if (__LinkerHints.Is_Windows_UI_Xaml_Controls_Border_Available)` will be removed when the `--feature Is_Windows_UI_Xaml_Controls_Border_Available false` parameter is provided to the linker.

Then the multiple passes of IL Linker are done:
- The first pass runs the IL Linker with all XAML resources and Binding Metadata disabled by setting all `__LinkerHints` properties to false. This removes all code directly associated to those Bindable Metadata and XAML Resources. This has the effect of only keeping framework code which is directly referenced from user code.
- The tooling then reads the result of the linker to determine which types in the `LinkerHints` are still available in the assemblies.
- The tooling then reads the result of the linker to determine which types in the `__LinkerHints` are still available in the assemblies.
- The subsequent passes run the IL Linker with `__LinkerHints` enabled only for types detected to be used during the first pass. This will enable types indirectly referenced by XAML Resources (e.g. a ScrollBar inside a ScrollViewer style) to be kept by the linker.
- The tooling then reads again the result of the linker to determine which types in the `__LinkerHints` are still available in the assemblies.
- The tooling re-runs this last pass until the available types list stops changing.
Expand Down

0 comments on commit e1bcd75

Please sign in to comment.