DesignerAttribute/EditorAttribute size implications #92043
Closed
Description
We annotated DesignerAttribute
/EditorAttribute
such that they preserve things on the type that is referred from the attribute.
These two attributes have huge size impact on WinForms - I'm seeing 25+%.
We should ideally do something about this.
- Should they actually be annotated? Would we ever expect a trimmed app to use these? (Removing the annotation would be a breaking change, but the break might be warranted.)
- If they should be annotated, do we want a feature switch to drop the attributes? I experimentally tried the thing in details below and saw 25+% savings.
- Should the default value of the feature switch be to remove them?
Diff (click to expand)
diff --git a/src/libraries/System.ComponentModel.Primitives/src/ILLink/ILLink.LinkAttributes.xml b/src/libraries/System.ComponentModel.Primitives/src/ILLink/ILLink.LinkAttributes.xml
new file mode 100644
index 00000000000..69c54060589
--- /dev/null
+++ b/src/libraries/System.ComponentModel.Primitives/src/ILLink/ILLink.LinkAttributes.xml
@@ -0,0 +1,10 @@
+<linker>
+ <assembly fullname="System.ComponentModel.Primitives" feature="System.ComponentModel.Designer.IsSupported" featurevalue="false">
+ <type fullname="System.ComponentModel.DesignerAttribute">
+ <attribute internal="RemoveAttributeInstances" />
+ </type>
+ <type fullname="System.ComponentModel.EditorAttribute">
+ <attribute internal="RemoveAttributeInstances" />
+ </type>
+ </assembly>
+</linker>
diff --git a/src/libraries/System.ComponentModel.Primitives/src/System.ComponentModel.Primitives.csproj b/src/libraries/System.ComponentModel.Primitives/src/System.ComponentModel.Primitives.csproj
index fe840c389fd..16e8cc1ef0f 100644
--- a/src/libraries/System.ComponentModel.Primitives/src/System.ComponentModel.Primitives.csproj
+++ b/src/libraries/System.ComponentModel.Primitives/src/System.ComponentModel.Primitives.csproj
@@ -7,6 +7,9 @@
-->
<GenerateResxSourceIncludeDefaultValues>true</GenerateResxSourceIncludeDefaultValues>
</PropertyGroup>
+ <ItemGroup>
+ <ILLinkLinkAttributesXmls Include="ILLink\ILLink.LinkAttributes.xml" />
+ </ItemGroup>
<ItemGroup>
<Compile Include="System\ComponentModel\ISynchronizeInvoke.cs" />
<Compile Include="System\ComponentModel\BrowsableAttribute.cs" />
Activity