Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Trimming] Use typed bindings internally #20567
[Trimming] Use typed bindings internally #20567
Changes from 8 commits
65873fd
e81d961
d046eef
7187e09
0786339
ff1ce39
2595a3d
eebcfce
9772a20
49ca865
244d955
53c26ae
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this
throw
? and then we put[RequiresUnreferencedCode]
on the setter of theDisplayMemberName
property?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if this should throw or not. When I'm running the app from the terminal, I don't see any stack trace or the exception message when the app crashes. Maybe do both?
The problem with
[RequiresUnreferencedCode]
onDisplayMemberName
is that it causes ~50 trimming warnings similar to this one:I am not sure why the static constructor would cause such a warning, but unfortunately, I don't know what to do about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if we have:
Was it warning about
nameof(DisplayMemberName)
? I think we can probably leave theBindableProperty
alone and only add the attribute to the setter ofDisplayMemberName
, if that is possible?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly the code that I had locally, and it produced the flood of trimming warnings (we can't apply the attribute to fields BTW). Maybe the warnings are a bug in ILC? @vitek-karas might know what's going on when he's back from vacation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it's probably not a bug, but it's still strange. We get 2 exactly same warnings on each line where we use
typeof(SearchHandler)
, for example:At the same time, the compiled XAML doesn't produce any warnings. That is because XamlC doesn't use the setter method, but it sets the value using
BindableObject.SetValue
:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very likely a problem in the trimmer - and possibly even in NativeAOT, but that I'm not sure of. The root cause is that the parameter to which we're passing
typeof(SearchHandler)
hasDAM(PublicProperties | PublicMethods)
.The
PublicProperties
will mark theDisplayMemberName
property as reflection accessible, which in turn marks the getter of it as reflection accessible -> warning.The
PublicMethods
will mark the getter direcly as reflection accessible -> warning.@sbomer as FYI.