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
{{ message }}
Repository navigation
XAML resource trimming keeps controls that are only type-checked #26048
area/performance 📈Categorizes an issue or PR as relevant to performancearea/xaml-trimmingCategorizes an issue or PR as relevant to XAML Trimmingkind/bugSomething isn't workingplatform/wasm 🌐Categorizes an issue or PR as relevant to the WebAssembly platform
With UnoXamlResourcesTrimming, LinkerHintGeneratorTask marks a DependencyObject type available whenever its TypeDef survives a linker pass. Any is check, cast or field of that type is enough to keep the TypeDef, so the type's hint becomes true. The bindable metadata then constructs it, which keeps its whole implementation.
In a blank unoapp (WebAssembly, Release, trimming on), framework code such as TextCore.IsTextControl and UIElement.OnContextRequestedCore does is RichEditBox. That keeps RichEditBox, its RTF codec and System.Text.Encoding.CodePages, plus ~110 other controls the app never creates (TextBox, ComboBox, MenuFlyout, ContentDialog, …).
Expected behavior 🎯
A control nothing can construct is trimmed together with its styles and metadata.
How to reproduce it (as minimally and precisely as possible) 🔬
dotnet new unoapp -preset blank -platforms wasm
Publish Release with -p:UnoXamlResourcesTrimming=true -p:_TrimmerDumpDependencies=true.
In obj/.../linked/linker-dependencies.xml, Blank.MetadataBuilder_N::Build reaches RichEditBox::.ctor().
Workaround 🛠️
None.
Affected platforms 📱💻🖥️
WebAssembly, and any trimmed head that uses XAML resource trimming.
Requiring a kept instance constructor (or an abstract type) saves 822 KB brotli on the blank app, and 600 KB on an app using 20 common controls, which renders pixel-identically.
area/performance 📈Categorizes an issue or PR as relevant to performancearea/xaml-trimmingCategorizes an issue or PR as relevant to XAML Trimmingkind/bugSomething isn't workingplatform/wasm 🌐Categorizes an issue or PR as relevant to the WebAssembly platform
Activity