You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistent warning code for array parameter passed to annotated location in ILLink/analyzer #96646
staticvoidMethod(Type[]interfaces){foreach(Typeiininterfaces)i.GetMethods();// warning here. IL2075 for analyzer, IL2065 for ILLink}
The ILLink Roslyn analyzer produces IL2075 (unannotated method return value flows to 'this' parameter with requirements), because it sees the return value of Current.get used as the receiver for GetMethods.
ILLink produces IL2065 ('this' parameter cannot be statically determined), because when it sees ldelem.ref of the array method parameter, it turns this into an "unknown" value, which has a different warning code.
Fundamentally this is due to the analyzer seeing a different lowering of the foreach loop than illink. Fixing this seems tricky.
Found while investigating #96462. There's an existing testcase similar to this:
Activity