Skip to content

Commit

Permalink
Remove unsupported _AggressiveAttributeTrimming switch (#109994)
Browse files Browse the repository at this point in the history
This switch was never documented and is not supported, because it can
cause behavior differences when trimming without any warnings.
  • Loading branch information
sbomer authored Nov 20, 2024
1 parent 1474fc3 commit 3b91ac6
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 380 deletions.
1 change: 0 additions & 1 deletion docs/workflow/trimming/feature-switches.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ configurations but their defaults might vary as any SDK can set the defaults dif
| DynamicCodeSupport | System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported | Changes RuntimeFeature.IsDynamicCodeSupported to false to allow testing AOT-safe fallback code without publishing for Native AOT. |
| EnableGeneratedComInterfaceComImportInterop | System.Runtime.InteropServices.Marshalling.EnableGeneratedComInterfaceComImportInterop | When set to true, enables casting source-generated COM object wrappers to built-in COM-based COM interfaces. |
| VerifyDependencyInjectionOpenGenericServiceTrimmability | Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability | When set to true, DependencyInjection will verify trimming annotations applied to open generic services are correct. |
| _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 |
| _ComObjectDescriptorSupport | System.ComponentModel.TypeDescriptor.IsComObjectDescriptorSupported | When set to true, supports creating a TypeDescriptor based view of COM objects. |
| _DataSetXmlSerializationSupport | System.Data.DataSet.XmlSerializationIsSupported | When set to false, DataSet implementation of IXmlSerializable will throw instead of using trim-incompatible XML serialization. |
| _DefaultValueAttributeSupport | System.ComponentModel.DefaultValueAttribute.IsSupported | When set to true, supports creating a DefaultValueAttribute at runtime. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,4 @@
</type>
</assembly>

<!-- Public attributes that need to be interpreted by the compiler, fine to strip afterwards -->
<assembly fullname="System.Private.CoreLib" feature="System.AggressiveAttributeTrimming" featurevalue="true">
<type fullname="System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CompilationRelaxationsAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.RuntimeCompatibilityAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
</assembly>

</linker>
Original file line number Diff line number Diff line change
Expand Up @@ -85,267 +85,4 @@
</type>
</assembly>

<!--
Attributes listed below here should be behind the 'System.AggressiveAttributeTrimming' feature switch, which
is only enabled by default on app models that need as much size savings as possible.
-->

<assembly fullname="System.Private.CoreLib" feature="System.AggressiveAttributeTrimming" featurevalue="true">
<!-- System -->
<type fullname="System.CLSCompliantAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.ObsoleteAttribute">
<!--
Note that removing this attribute can change runtime behavior. For example,
System.Xml.Serialization will behave differently if a ctor is Obsolete.
This is low enough risk on when 'System.AggressiveAttributeTrimming' is enabled to justify
removing the attribute for size savings. The app developer can override this setting
to keep all ObsoleteAttributes.
-->
<attribute internal="RemoveAttributeInstances" />
</type>

<!-- System.Diagnostics.CodeAnalysis -->
<type fullname="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.ExperimentalAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>

<!-- System.Reflection -->
<type fullname="System.Reflection.AssemblyCompanyAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Reflection.AssemblyConfigurationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Reflection.AssemblyCopyrightAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Reflection.AssemblyDefaultAliasAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Reflection.AssemblyDescriptionAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Reflection.AssemblyProductAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Reflection.AssemblyTitleAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>

<!-- System.Runtime.CompilerServices -->
<type fullname="System.Runtime.CompilerServices.AsyncMethodBuilderAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CallerArgumentExpressionAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CallerMemberNameAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CallerFilePathAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CallerLineNumberAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CallerMemberNameAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CompilerGlobalScopeAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.IsReadOnlyAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.EnumeratorCancellationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.ExtensionAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.SkipLocalsInitAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.TupleElementNamesAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>

<!-- System.Runtime.Versioning -->
<type fullname="System.Runtime.Versioning.SupportedOSPlatformAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.Versioning.UnsupportedOSPlatformAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.Versioning.ObsoletedOSPlatformAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.Versioning.RequiresPreviewFeaturesAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.Versioning.SupportedOSPlatformGuardAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.Versioning.TargetPlatformAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>

<!-- System.ComponentModel -->
<type fullname="System.ComponentModel.EditorBrowsableAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
</assembly>

<!-- Attributes that are allowed to be in any assembly -->
<assembly fullname="*" feature="System.AggressiveAttributeTrimming" featurevalue="true">
<!-- Attributes that tooling allows to be in any assembly to support earlier TFMs -->
<type fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.FeatureGuardAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.SuppressMessageAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.NotNullWhenAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.MemberNotNullAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.StringSyntaxAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.CodeAnalysis.UnscopedRefAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.InteropServices.LibraryImportAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.InteropServices.Marshalling.ContiguousCollectionMarshallerAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.InteropServices.Marshalling.CustomMarshallerAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.InteropServices.Marshalling.NativeMarshallingAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.InteropServices.Marshalling.MarshalUsingAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.CodeDom.Compiler.GeneratedCodeAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>

<!-- The following attributes are generated by the compiler, so they could be in any assembly -->

<!-- System.Runtime.CompilerServices -->
<type fullname="System.Runtime.CompilerServices.IsUnmanagedAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.NativeIntegerAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.ScopedRefAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.RefSafetyRulesAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>

<!-- Microsoft.CodeAnalysis -->
<type fullname="Microsoft.CodeAnalysis.EmbeddedAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>

<!-- Metadata attributes present in most core SDKs assemblies -->
<type fullname="System.Reflection.AssemblyMetadataAttribute">
<attribute internal="RemoveAttributeInstances">
<argument type="System.Object">
<argument>Serviceable</argument>
</argument>
</attribute>
</type>
<type fullname="System.Reflection.AssemblyMetadataAttribute">
<attribute internal="RemoveAttributeInstances">
<argument type="System.Object">
<argument>PreferInbox</argument>
</argument>
</attribute>
</type>
<type fullname="System.Reflection.AssemblyMetadataAttribute">
<attribute internal="RemoveAttributeInstances">
<argument type="System.Object">
<argument>RepositoryUrl</argument>
</argument>
</attribute>
</type>
<type fullname="System.Reflection.AssemblyMetadataAttribute">
<attribute internal="RemoveAttributeInstances">
<argument type="System.Object">
<argument>SourceCommitUrl</argument>
</argument>
</attribute>
</type>
<type fullname="System.Reflection.AssemblyMetadataAttribute">
<attribute internal="RemoveAttributeInstances">
<argument type="System.Object">
<argument>CommitHash</argument>
</argument>
</attribute>
</type>
<type fullname="System.Reflection.AssemblyMetadataAttribute">
<attribute internal="RemoveAttributeInstances">
<argument type="System.Object">
<argument>IsTrimmable</argument>
</argument>
</attribute>
</type>
</assembly>
</linker>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />

<ItemGroup>
<TestConsoleAppSourceFiles Include="AggressiveAttributeTrimmingTest.cs">
<EnabledProperties>_AggressiveAttributeTrimming</EnabledProperties>
<DisabledProperties>SuppressTrimAnalysisWarnings;TrimmerSingleWarn</DisabledProperties>
</TestConsoleAppSourceFiles>
<TestConsoleAppSourceFiles Include="AppDomainGetThreadGenericPrincipalTest.cs" />
<TestConsoleAppSourceFiles Include="AppDomainGetThreadWindowsPrincipalTest.cs">
<SkipOnTestRuntimes>osx-x64;linux-x64;browser-wasm</SkipOnTestRuntimes>
Expand Down
3 changes: 0 additions & 3 deletions src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.wasm.singlethread.xml" Condition="'$(Platform)' == 'wasm' and '$(FeatureWasmManagedThreads)' != 'true'" />
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.Intrinsics.x86.xml" />
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.Intrinsics.Vectors.xml" />

<ILLinkLinkAttributesXmls Include="$(ILLinkDirectory)ILLink.LinkAttributes.xml" />
<ILLinkLinkAttributesXmls Include="$(ILLinkDirectory)ILLink.LinkAttributes.$(Platform).xml" Condition="Exists('$(ILLinkDirectory)ILLink.LinkAttributes.$(Platform).xml')" />
</ItemGroup>

<!-- Sources -->
Expand Down
Loading

0 comments on commit 3b91ac6

Please sign in to comment.