Open
Description
For code like this:
public static IEnumerable<int> IteratorWithIntegerDataflow ()
{
int integerLocal = 0;
yield return 0;
var types = new Type[] { GetWithPublicMethods (), GetWithPublicFields () };
types[integerLocal].RequiresPublicMethods ();
}
ILLink tracks assignments and reads of the int local, and before #110105 this was enough for the analysis to determine that array element 0 satisfies PublicMethods.
The dependency update changed the iterator codegen, introducing a dispose method that assigns null
to the array. This interferes with the analysis and causes this to report a warning:
Trim analysis warning IL2062: Mono.Linker.Tests.Cases.DataFlow.CompilerGeneratedCodeAccessedViaReflection.IteratorStateMachines.<IteratorWithIntegerDataflow>d__3.MoveNext(): Value passed to parameter 'type' of method 'Mono.Linker.Tests.Cases.Expectations.Helpers.DataFlowTypeExtensions.RequiresPublicMethods(Type)' can not be statically determined and may not meet 'DynamicallyAccessedMembersAttribute' requirements.
Metadata
Metadata
Assignees
Type
Projects
Status
No status