[Trimming] Fix trimming unfriendly usage of implicit operators through reflection #19922
Labels
area-publishing
Issues with the app packaging/publishing process (ipk/apk/msix/trimming)
fixed-in-9.0.0-preview.3.10457
t/app-size
Application Size / Trimming (sub: perf)
Milestone
MAUI uses implicit operators invoked via reflection in several places, for example:
BindableProperty.TryConvert(...)
BindableObject.SetValue(...)
is usedStaticResourceExtension.ProvideValue(...)
Unfortunately, this pattern isn't trimming/AOT compatible and we cannot fix it with
[DynamicallyAccessedMembers]
(in some cases the type isn't known at compile time, such as invalue.GetType().GetImplicitConversionOperator(...)
). When app code is trimmed, some of the required implicit conversion operators might not be available at runtime leading to unexpected behavior.Related to #18658, /cc @jonathanpeppers
Trimming warnings related to this issue are tracked in #19397
Possible solutions
IValueConverter
[Preserve]
or[DynamicDependency]
The text was updated successfully, but these errors were encountered: