We should create a list of all the attributes in our platform assembly (sorted by how often they appear), and go through each of them to answer if they're needed.
The investigation and implementation plan are documented in this analysis gist.
Except for attributes that are safe to remove unconditionally, removal must only happen when all these conditions are true:
PrepareAssemblies=true
PostProcessAssemblies=true
- The
trimmable-static registrar is used
Implementation checklist:
Attributes removed by RemoveAttributesStep should be moved to trimmer xml files like ProtocolMemberAttribute, because the RemoveAttributesStep isn't executed for NativeAOT:
We should create a list of all the attributes in our platform assembly (sorted by how often they appear), and go through each of them to answer if they're needed.
The investigation and implementation plan are documented in this analysis gist.
Except for attributes that are safe to remove unconditionally, removal must only happen when all these conditions are true:
PrepareAssemblies=truePostProcessAssemblies=truetrimmable-staticregistrar is usedImplementation checklist:
Foundation.ProtocolMemberAttribute— implemented in [linker] Trim [ProtocolMember] attributes with trimmable-static + PrepareAssemblies #26089; update its feature condition to includePostProcessAssemblies=true.Foundation.RequiredMemberAttribute— remove unconditionally.Foundation.OptionalMemberAttribute— remove unconditionally.System.Runtime.CompilerServices.ExtensionAttribute— remove under the shared eligibility gate.Foundation.ModelAttribute— remove under the shared eligibility gate.ObjCRuntime.NativeAttribute— remove under the shared eligibility gate.Foundation.RegisterAttribute— remove under the shared eligibility gate whenIsDirectBindingis known to betrue.Foundation.ExportAttribute— remove under the shared eligibility gate from eligible direct-bindingNSObjectwrappers and sealedBaseWrapperprotocol wrappers, after verifying runtime block/delegate fallback paths.Attributes removed by
RemoveAttributesStepshould be moved to trimmer xml files like ProtocolMemberAttribute, because theRemoveAttributesStepisn't executed for NativeAOT:Foundation.ProtocolAttributeObjCRuntime.NativeNameAttributeObjCRuntime.AdoptsAttribute