-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maui's usage of Reflection to find op_Implicit operators is not trim-compatible #5023
Comments
Ideally we would pursue 1. if possible - remove this code from Maui. If that doesn't work, we could extend the fix we did for |
Is this an improvement? #5073 Should we do the whole thing differently? What happens if we have a non - generic base or something? We cast anyways, so we can maybe get the value and then cast. It will throw us out was wrong. |
the reason op_implicit is there isn't to convert from string (we have TypeConverters for that), but for the other cases, like when you provide a Color to a Brush. Iirc it was added for Shell support, so participants in the Shell can be promoted to their parent (you declare a ShellContent when it expects a ShellSection). As with everything else XAML and Binding, we don't know what we'll be used til runtime unless we enforce XamlC everywhere. That's something I'd want, but won't happen right away |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Hi @eerhardt. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version. You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Description
We are getting ILLink trim warnings in the following code:
maui/src/Controls/src/Core/Xaml/TypeConversionExtensions.cs
Lines 254 to 271 in cf6896e
Here are the warnings:
This issue is that if the trimmer doesn't see these
op_Implicit
operators being used in IL, it will trim them. This will cause the above code to behave differently in a trimmed application, since the operator is removed. This code won't find it, and it won't be used to do the conversions that it is supposed to do.Options
I can only think of 2 high-level options to fix this:
TypeConverters
to be used to convert values. This means anything that relies on theseop_Implicit
operators from working would need to be fixed. But at least the behavior would be consistent with or without trimming.op_Implicit
operators. We did something similar for System.Linq.Expressions in Preserving operator methods necessary for System.Linq.Expressions linker#1821.cc @mattleibow @PureWeen @StephaneDelcroix @vitek-karas
Steps to Reproduce
(These steps are fuzzy, let me know if you need more detailed steps)
op_Implicit
operator to do a conversion from astring
.Notice that the conversion through the
op_Implicit
operator doesn't happen in the trimmed app because it was trimmed away.Version with bug
Preview 13 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android
Affected platform versions
All
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: