Skip to content

Commit 636a20c

Browse files
sbomermikelle-rogers
authored andcommitted
Remove unsupported _AggressiveAttributeTrimming switch (dotnet#109994)
This switch was never documented and is not supported, because it can cause behavior differences when trimming without any warnings.
1 parent a47549a commit 636a20c

File tree

7 files changed

+0
-380
lines changed

7 files changed

+0
-380
lines changed

docs/workflow/trimming/feature-switches.md

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ configurations but their defaults might vary as any SDK can set the defaults dif
1212
| DynamicCodeSupport | System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported | Changes RuntimeFeature.IsDynamicCodeSupported to false to allow testing AOT-safe fallback code without publishing for Native AOT. |
1313
| EnableGeneratedComInterfaceComImportInterop | System.Runtime.InteropServices.Marshalling.EnableGeneratedComInterfaceComImportInterop | When set to true, enables casting source-generated COM object wrappers to built-in COM-based COM interfaces. |
1414
| VerifyDependencyInjectionOpenGenericServiceTrimmability | Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability | When set to true, DependencyInjection will verify trimming annotations applied to open generic services are correct. |
15-
| _AggressiveAttributeTrimming | System.AggressiveAttributeTrimming | When set to true, aggressively trims attributes to allow for the most size savings possible, even if it could result in runtime behavior changes |
1615
| _ComObjectDescriptorSupport | System.ComponentModel.TypeDescriptor.IsComObjectDescriptorSupported | When set to true, supports creating a TypeDescriptor based view of COM objects. |
1716
| _DataSetXmlSerializationSupport | System.Data.DataSet.XmlSerializationIsSupported | When set to false, DataSet implementation of IXmlSerializable will throw instead of using trim-incompatible XML serialization. |
1817
| _DefaultValueAttributeSupport | System.ComponentModel.DefaultValueAttribute.IsSupported | When set to true, supports creating a DefaultValueAttribute at runtime. |

src/coreclr/nativeaot/System.Private.CoreLib/src/ILLink/ILLink.LinkAttributes.xml

-13
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,4 @@
2020
</type>
2121
</assembly>
2222

23-
<!-- Public attributes that need to be interpreted by the compiler, fine to strip afterwards -->
24-
<assembly fullname="System.Private.CoreLib" feature="System.AggressiveAttributeTrimming" featurevalue="true">
25-
<type fullname="System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute">
26-
<attribute internal="RemoveAttributeInstances" />
27-
</type>
28-
<type fullname="System.Runtime.CompilerServices.CompilationRelaxationsAttribute">
29-
<attribute internal="RemoveAttributeInstances" />
30-
</type>
31-
<type fullname="System.Runtime.CompilerServices.RuntimeCompatibilityAttribute">
32-
<attribute internal="RemoveAttributeInstances" />
33-
</type>
34-
</assembly>
35-
3623
</linker>

src/libraries/System.Private.CoreLib/src/ILLink/ILLink.LinkAttributes.Shared.xml

-263
Original file line numberDiff line numberDiff line change
@@ -85,267 +85,4 @@
8585
</type>
8686
</assembly>
8787

88-
<!--
89-
Attributes listed below here should be behind the 'System.AggressiveAttributeTrimming' feature switch, which
90-
is only enabled by default on app models that need as much size savings as possible.
91-
-->
92-
93-
<assembly fullname="System.Private.CoreLib" feature="System.AggressiveAttributeTrimming" featurevalue="true">
94-
<!-- System -->
95-
<type fullname="System.CLSCompliantAttribute">
96-
<attribute internal="RemoveAttributeInstances" />
97-
</type>
98-
<type fullname="System.ObsoleteAttribute">
99-
<!--
100-
Note that removing this attribute can change runtime behavior. For example,
101-
System.Xml.Serialization will behave differently if a ctor is Obsolete.
102-
This is low enough risk on when 'System.AggressiveAttributeTrimming' is enabled to justify
103-
removing the attribute for size savings. The app developer can override this setting
104-
to keep all ObsoleteAttributes.
105-
-->
106-
<attribute internal="RemoveAttributeInstances" />
107-
</type>
108-
109-
<!-- System.Diagnostics.CodeAnalysis -->
110-
<type fullname="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute">
111-
<attribute internal="RemoveAttributeInstances" />
112-
</type>
113-
<type fullname="System.Diagnostics.CodeAnalysis.ExperimentalAttribute">
114-
<attribute internal="RemoveAttributeInstances" />
115-
</type>
116-
117-
<!-- System.Reflection -->
118-
<type fullname="System.Reflection.AssemblyCompanyAttribute">
119-
<attribute internal="RemoveAttributeInstances" />
120-
</type>
121-
<type fullname="System.Reflection.AssemblyConfigurationAttribute">
122-
<attribute internal="RemoveAttributeInstances" />
123-
</type>
124-
<type fullname="System.Reflection.AssemblyCopyrightAttribute">
125-
<attribute internal="RemoveAttributeInstances" />
126-
</type>
127-
<type fullname="System.Reflection.AssemblyDefaultAliasAttribute">
128-
<attribute internal="RemoveAttributeInstances" />
129-
</type>
130-
<type fullname="System.Reflection.AssemblyDescriptionAttribute">
131-
<attribute internal="RemoveAttributeInstances" />
132-
</type>
133-
<type fullname="System.Reflection.AssemblyProductAttribute">
134-
<attribute internal="RemoveAttributeInstances" />
135-
</type>
136-
<type fullname="System.Reflection.AssemblyTitleAttribute">
137-
<attribute internal="RemoveAttributeInstances" />
138-
</type>
139-
140-
<!-- System.Runtime.CompilerServices -->
141-
<type fullname="System.Runtime.CompilerServices.AsyncMethodBuilderAttribute">
142-
<attribute internal="RemoveAttributeInstances" />
143-
</type>
144-
<type fullname="System.Runtime.CompilerServices.CallerArgumentExpressionAttribute">
145-
<attribute internal="RemoveAttributeInstances" />
146-
</type>
147-
<type fullname="System.Runtime.CompilerServices.CallerMemberNameAttribute">
148-
<attribute internal="RemoveAttributeInstances" />
149-
</type>
150-
<type fullname="System.Runtime.CompilerServices.CallerFilePathAttribute">
151-
<attribute internal="RemoveAttributeInstances" />
152-
</type>
153-
<type fullname="System.Runtime.CompilerServices.CallerLineNumberAttribute">
154-
<attribute internal="RemoveAttributeInstances" />
155-
</type>
156-
<type fullname="System.Runtime.CompilerServices.CallerMemberNameAttribute">
157-
<attribute internal="RemoveAttributeInstances" />
158-
</type>
159-
<type fullname="System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute">
160-
<attribute internal="RemoveAttributeInstances" />
161-
</type>
162-
<type fullname="System.Runtime.CompilerServices.CompilerGlobalScopeAttribute">
163-
<attribute internal="RemoveAttributeInstances" />
164-
</type>
165-
<type fullname="System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute">
166-
<attribute internal="RemoveAttributeInstances" />
167-
</type>
168-
<type fullname="System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute">
169-
<attribute internal="RemoveAttributeInstances" />
170-
</type>
171-
<type fullname="System.Runtime.CompilerServices.IsReadOnlyAttribute">
172-
<attribute internal="RemoveAttributeInstances" />
173-
</type>
174-
<type fullname="System.Runtime.CompilerServices.EnumeratorCancellationAttribute">
175-
<attribute internal="RemoveAttributeInstances" />
176-
</type>
177-
<type fullname="System.Runtime.CompilerServices.ExtensionAttribute">
178-
<attribute internal="RemoveAttributeInstances" />
179-
</type>
180-
<type fullname="System.Runtime.CompilerServices.SkipLocalsInitAttribute">
181-
<attribute internal="RemoveAttributeInstances" />
182-
</type>
183-
<type fullname="System.Runtime.CompilerServices.TupleElementNamesAttribute">
184-
<attribute internal="RemoveAttributeInstances" />
185-
</type>
186-
187-
<!-- System.Runtime.Versioning -->
188-
<type fullname="System.Runtime.Versioning.SupportedOSPlatformAttribute">
189-
<attribute internal="RemoveAttributeInstances" />
190-
</type>
191-
<type fullname="System.Runtime.Versioning.UnsupportedOSPlatformAttribute">
192-
<attribute internal="RemoveAttributeInstances" />
193-
</type>
194-
<type fullname="System.Runtime.Versioning.ObsoletedOSPlatformAttribute">
195-
<attribute internal="RemoveAttributeInstances" />
196-
</type>
197-
<type fullname="System.Runtime.Versioning.RequiresPreviewFeaturesAttribute">
198-
<attribute internal="RemoveAttributeInstances" />
199-
</type>
200-
<type fullname="System.Runtime.Versioning.SupportedOSPlatformGuardAttribute">
201-
<attribute internal="RemoveAttributeInstances" />
202-
</type>
203-
<type fullname="System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute">
204-
<attribute internal="RemoveAttributeInstances" />
205-
</type>
206-
<type fullname="System.Runtime.Versioning.TargetPlatformAttribute">
207-
<attribute internal="RemoveAttributeInstances" />
208-
</type>
209-
210-
<!-- System.ComponentModel -->
211-
<type fullname="System.ComponentModel.EditorBrowsableAttribute">
212-
<attribute internal="RemoveAttributeInstances" />
213-
</type>
214-
</assembly>
215-
216-
<!-- Attributes that are allowed to be in any assembly -->
217-
<assembly fullname="*" feature="System.AggressiveAttributeTrimming" featurevalue="true">
218-
<!-- Attributes that tooling allows to be in any assembly to support earlier TFMs -->
219-
<type fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute">
220-
<attribute internal="RemoveAttributeInstances" />
221-
</type>
222-
<type fullname="System.Diagnostics.CodeAnalysis.FeatureGuardAttribute">
223-
<attribute internal="RemoveAttributeInstances" />
224-
</type>
225-
<type fullname="System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute">
226-
<attribute internal="RemoveAttributeInstances" />
227-
</type>
228-
<type fullname="System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute">
229-
<attribute internal="RemoveAttributeInstances" />
230-
</type>
231-
<type fullname="System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute">
232-
<attribute internal="RemoveAttributeInstances" />
233-
</type>
234-
<type fullname="System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute">
235-
<attribute internal="RemoveAttributeInstances" />
236-
</type>
237-
<type fullname="System.Diagnostics.CodeAnalysis.SuppressMessageAttribute">
238-
<attribute internal="RemoveAttributeInstances" />
239-
</type>
240-
<type fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
241-
<attribute internal="RemoveAttributeInstances" />
242-
</type>
243-
<type fullname="System.Diagnostics.CodeAnalysis.NotNullWhenAttribute">
244-
<attribute internal="RemoveAttributeInstances" />
245-
</type>
246-
<type fullname="System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute">
247-
<attribute internal="RemoveAttributeInstances" />
248-
</type>
249-
<type fullname="System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute">
250-
<attribute internal="RemoveAttributeInstances" />
251-
</type>
252-
<type fullname="System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute">
253-
<attribute internal="RemoveAttributeInstances" />
254-
</type>
255-
<type fullname="System.Diagnostics.CodeAnalysis.MemberNotNullAttribute">
256-
<attribute internal="RemoveAttributeInstances" />
257-
</type>
258-
<type fullname="System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute">
259-
<attribute internal="RemoveAttributeInstances" />
260-
</type>
261-
<type fullname="System.Diagnostics.CodeAnalysis.StringSyntaxAttribute">
262-
<attribute internal="RemoveAttributeInstances" />
263-
</type>
264-
<type fullname="System.Diagnostics.CodeAnalysis.UnscopedRefAttribute">
265-
<attribute internal="RemoveAttributeInstances" />
266-
</type>
267-
<type fullname="System.Runtime.InteropServices.LibraryImportAttribute">
268-
<attribute internal="RemoveAttributeInstances" />
269-
</type>
270-
<type fullname="System.Runtime.InteropServices.Marshalling.ContiguousCollectionMarshallerAttribute">
271-
<attribute internal="RemoveAttributeInstances" />
272-
</type>
273-
<type fullname="System.Runtime.InteropServices.Marshalling.CustomMarshallerAttribute">
274-
<attribute internal="RemoveAttributeInstances" />
275-
</type>
276-
<type fullname="System.Runtime.InteropServices.Marshalling.NativeMarshallingAttribute">
277-
<attribute internal="RemoveAttributeInstances" />
278-
</type>
279-
<type fullname="System.Runtime.InteropServices.Marshalling.MarshalUsingAttribute">
280-
<attribute internal="RemoveAttributeInstances" />
281-
</type>
282-
<type fullname="System.CodeDom.Compiler.GeneratedCodeAttribute">
283-
<attribute internal="RemoveAttributeInstances" />
284-
</type>
285-
286-
<!-- The following attributes are generated by the compiler, so they could be in any assembly -->
287-
288-
<!-- System.Runtime.CompilerServices -->
289-
<type fullname="System.Runtime.CompilerServices.IsUnmanagedAttribute">
290-
<attribute internal="RemoveAttributeInstances" />
291-
</type>
292-
<type fullname="System.Runtime.CompilerServices.NativeIntegerAttribute">
293-
<attribute internal="RemoveAttributeInstances" />
294-
</type>
295-
<type fullname="System.Runtime.CompilerServices.ScopedRefAttribute">
296-
<attribute internal="RemoveAttributeInstances" />
297-
</type>
298-
<type fullname="System.Runtime.CompilerServices.RefSafetyRulesAttribute">
299-
<attribute internal="RemoveAttributeInstances" />
300-
</type>
301-
302-
<!-- Microsoft.CodeAnalysis -->
303-
<type fullname="Microsoft.CodeAnalysis.EmbeddedAttribute">
304-
<attribute internal="RemoveAttributeInstances" />
305-
</type>
306-
307-
<!-- Metadata attributes present in most core SDKs assemblies -->
308-
<type fullname="System.Reflection.AssemblyMetadataAttribute">
309-
<attribute internal="RemoveAttributeInstances">
310-
<argument type="System.Object">
311-
<argument>Serviceable</argument>
312-
</argument>
313-
</attribute>
314-
</type>
315-
<type fullname="System.Reflection.AssemblyMetadataAttribute">
316-
<attribute internal="RemoveAttributeInstances">
317-
<argument type="System.Object">
318-
<argument>PreferInbox</argument>
319-
</argument>
320-
</attribute>
321-
</type>
322-
<type fullname="System.Reflection.AssemblyMetadataAttribute">
323-
<attribute internal="RemoveAttributeInstances">
324-
<argument type="System.Object">
325-
<argument>RepositoryUrl</argument>
326-
</argument>
327-
</attribute>
328-
</type>
329-
<type fullname="System.Reflection.AssemblyMetadataAttribute">
330-
<attribute internal="RemoveAttributeInstances">
331-
<argument type="System.Object">
332-
<argument>SourceCommitUrl</argument>
333-
</argument>
334-
</attribute>
335-
</type>
336-
<type fullname="System.Reflection.AssemblyMetadataAttribute">
337-
<attribute internal="RemoveAttributeInstances">
338-
<argument type="System.Object">
339-
<argument>CommitHash</argument>
340-
</argument>
341-
</attribute>
342-
</type>
343-
<type fullname="System.Reflection.AssemblyMetadataAttribute">
344-
<attribute internal="RemoveAttributeInstances">
345-
<argument type="System.Object">
346-
<argument>IsTrimmable</argument>
347-
</argument>
348-
</attribute>
349-
</type>
350-
</assembly>
35188
</linker>

src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/AggressiveAttributeTrimmingTest.cs

-80
This file was deleted.

src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/System.Runtime.TrimmingTests.proj

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />
33

44
<ItemGroup>
5-
<TestConsoleAppSourceFiles Include="AggressiveAttributeTrimmingTest.cs">
6-
<EnabledProperties>_AggressiveAttributeTrimming</EnabledProperties>
7-
<DisabledProperties>SuppressTrimAnalysisWarnings;TrimmerSingleWarn</DisabledProperties>
8-
</TestConsoleAppSourceFiles>
95
<TestConsoleAppSourceFiles Include="AppDomainGetThreadGenericPrincipalTest.cs" />
106
<TestConsoleAppSourceFiles Include="AppDomainGetThreadWindowsPrincipalTest.cs">
117
<SkipOnTestRuntimes>osx-x64;linux-x64;browser-wasm</SkipOnTestRuntimes>

src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj

-3
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@
142142
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.wasm.singlethread.xml" Condition="'$(Platform)' == 'wasm' and '$(FeatureWasmManagedThreads)' != 'true'" />
143143
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.Intrinsics.x86.xml" />
144144
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.Intrinsics.Vectors.xml" />
145-
146-
<ILLinkLinkAttributesXmls Include="$(ILLinkDirectory)ILLink.LinkAttributes.xml" />
147-
<ILLinkLinkAttributesXmls Include="$(ILLinkDirectory)ILLink.LinkAttributes.$(Platform).xml" Condition="Exists('$(ILLinkDirectory)ILLink.LinkAttributes.$(Platform).xml')" />
148145
</ItemGroup>
149146

150147
<!-- Sources -->

0 commit comments

Comments
 (0)