Skip to content

Clean up TrimmingTests infrastructure #48848

@eerhardt

Description

@eerhardt

There are a few things in our TrimmingTests that could be cleaned up.

<!-- These can be removed once we get an SDK with https://github.com/mono/linker/pull/1385. -->
<LinkerNoWarn>IL2026</LinkerNoWarn>
<!-- IL2032,IL2055,IL2057-IL2061: Reflection intrinsics with unknown arguments -->
<LinkerNoWarn>$(LinkerNoWarn);IL2032;IL2055;IL2057;IL2058;IL2059;IL2060;IL2061</LinkerNoWarn>
<!-- IL2062-IL2066: Unknown values passed to locations with DynamicallyAccessedMemberTypes -->
<LinkerNoWarn>$(LinkerNoWarn);IL2062;IL2063;IL2064;IL2065;IL2066</LinkerNoWarn>
<!-- IL2067-IL2091: Unsatisfied DynamicallyAccessedMembers requirements -->
<LinkerNoWarn>$(LinkerNoWarn);IL2067;IL2068;IL2069;IL2070;IL2071;IL2072;IL2073;IL2074;IL2075;IL2076;IL2077;IL2078;IL2079;IL2080;IL2081;IL2082;IL2083;IL2084;IL2085;IL2086;IL2087;IL2088;IL2089;IL2090;IL2091</LinkerNoWarn>
<!-- https://github.com/dotnet/runtime/issues/40336 - need to suppress IL2008;IL2009;IL2037 on non-Windows -->
<LinkerNoWarn Condition="!$(RuntimeIdentifier.StartsWith('win'))">$(LinkerNoWarn);IL2008;IL2009;IL2037</LinkerNoWarn>
<_ExtraTrimmerArgs>{ExtraTrimmerArgs} $(_ExtraTrimmerArgs) --nowarn $(LinkerNoWarn)</_ExtraTrimmerArgs>

Also, once we have an SDK with dotnet/sdk#16094 (which I believe will be a 6.0-preview3 sdk), we can remove:

<Target Name="EnsureAllAssembliesAreLinked"
BeforeTargets="PrepareForILLink">
<ItemGroup>
<ManagedAssemblyToLink>
<TrimMode>link</TrimMode>
</ManagedAssemblyToLink>
<!-- Pass the app assembly as a root -->
<TrimmerRootAssembly Include="@(IntermediateAssembly)" />
</ItemGroup>
</Target>

And just generate IsTrimmable=true assembly metadata on the console apps, which will ensure they are fully trimmed.

cc @joperezr

Metadata

Metadata

Assignees

Labels

area-Metalinkable-frameworkIssues associated with delivering a linker friendly frameworktest-enhancementImprovements of test source code

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions