-
Notifications
You must be signed in to change notification settings - Fork 4.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
Reduce the trim requirements on MetadataUpdateHandlerAttribute #66069
Comments
Tagging subscribers to this area: @dotnet/area-system-reflection Issue DetailsCurrently the type passed to the But this does matter for analysis of libraries for trimming. The My reading of the usage of Can we improve the annotation on the
|
For my edification, can you share an example from one of our handlers where this is causing an issue? |
I filed the issue because of this: dotnet/aspnetcore#40430 (comment) The reduction of the annotation would not fix all of the problems (it would still require all methods and some of those warnings are about methods), but it would help. We're solving the problem in ASP.NET by creating a subclass which will act solely as the update handler, the attribute points to it and the static methods then do what is necessary (either directly or by forwarding the call to the parent class). Actually, this feels like the best approach right now for the update handlers in general. I'm wondering if we could also use static abstract methods on interfaces for this purpose - that would allow precise behavior. Personally I don't like these magical behaviors of "and something will call a method with name |
The |
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr Issue DetailsCurrently the type passed to the But this does matter for analysis of libraries for trimming. The My reading of the usage of Can we improve the annotation on the
|
Moving to 8.0; we want to be more linker-friendly in 8.0. |
Currently the type passed to the
.ctor
ofMetadataUpdateHandlerAttribute
will be annotated withDynamicallyAccessedMemberTypes.All
. For apps this doesn't matter because the attribute is marked for removal in trimmed apps by default, so the annotation is not applied.But this does matter for analysis of libraries for trimming. The
All
annotation is particularly problematic because it will force include all nested types and may cause additional warnings produced by the analysis as it will treat all members on the type as potentially accessed via reflection (so any member annotated for trimming in any way will produce a warning).My reading of the usage of
MetadataUpdateHandlerAttribute
shows that we only need methods on the target type (in fact we only need two specific static methods, but there's no way to annotate it that way right now).Can we improve the annotation on the
MetadataUpdateHandlerAttribute
to only ask for methods:DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods
?The text was updated successfully, but these errors were encountered: