ILC fails to detect and trim some dependency cycles (interface -> attribute -> [DAM] -> type impl -> new()) #112029
Labels
area-NativeAOT-coreclr
partner-impact
This issue impacts a partner who needs to be kept updated
trimming-for-aot
`EnableAggressiveTrimming=true` used for running tests with AOT
untriaged
New issue has not been triaged by the area owner
Description
Found a possible miss by ILC when working on microsoft/CsWinRT#1907. This causes
IReferenceArray<T>
to be kept, which then produces a bunch of IL3050 warnings when I try to publish the Microsoft Store with a preview of CsWinRT from that PR. We can reworkIReferenceArray<T>
to be more AOT friendly, but this feels also feels like something that ILC should be able to handle.cc. @MichalStrehovsky @sbomer
Reproduction Steps
Expected behavior
IFoo<T>
types should be completely trimmed.M
to be optimized to justreturn false
, basically.KeepAttribute
should also be removed.There is no type that can possibly be instantiated, that implements
IFoo<T>
.Actual behavior
Both
IFoo<T>
types and[Keep]
are kept. Not sure ifM
is being optimized (don't see the codegen from here).Additional context
I tried changing the
Create
method to this:Thinking maybe if this just throws on AOT, ILC will see the type never being constructed and will trim. Nope, no changes.
Regression?
No.
Configuration
The text was updated successfully, but these errors were encountered: