Open sbomer opened 6 months ago
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas See info in area-owners.md if you want to be subscribed.
Author: | sbomer |
---|---|
Assignees: | - |
Labels: | `untriaged`, `area-Tools-ILLink`, `needs-area-label` |
Milestone: | - |
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 forGetMethods
.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 https://github.com/dotnet/runtime/pull/96462. There's an existing testcase similar to this:
https://github.com/dotnet/runtime/blob/0451127421fe7862f0e8407eafd6052d7ea3b175/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs#L443-L453