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 }}
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
[return:DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]publicstaticTypeTestBackwardEdgeWithLdElem(Type[]types=null){TyperesultType=null;// returning null is fine, it fulfills any annotationforeach(vartypeintypes){// this is effectively ldelem, which should produce "unknown" valueresultType=type;// assigns "unknown" to the result}returnresultType;// IL2063: "unknown" doesn't have requires annotations}
Internally the "unknown" value loaded from the array is represented as StackSlot with null Value. The null literal is represented as NullValue. What happens inside the loop is that we're storing a second value for a local, so we merge the "unknown" and NullValue. But because the "unknown" is represented as null, the merge ignores it, and we end up with just the NullValue, which won't produce a warning.
@MichalStrehovsky for potential ideas... if you feel like diving back into the method body scanner.
Hehe, I never really dived much into it - that was part of the appeal of just reusing existing code - just make it build, delete features we don't need and done. It was a mechanical port without much thinking.
The test is already enabled for linker (came with the big merge). Analyzer will be a bit harder since the CFG's way of modeling foreach makes it rather difficult.
Activity
Adds a test for brackward branch merging an unknown value to the result
vitek-karas commentedon Feb 17, 2022
@MichalStrehovsky for potential ideas... if you feel like diving back into the method body scanner.
Adds a test for brackward branch merging an unknown value to the resu…
Fix merging null and non-null stack slots
MichalStrehovsky commentedon Feb 18, 2022
Hehe, I never really dived much into it - that was part of the appeal of just reusing existing code - just make it build, delete features we don't need and done. It was a mechanical port without much thinking.
I took a shot at it in #2631.
MichalStrehovsky commentedon Feb 22, 2022
I think all that's left here is to enable the test. This was fixed somewhere in #2614.
vitek-karas commentedon Feb 22, 2022
The test is already enabled for linker (came with the big merge). Analyzer will be a bit harder since the CFG's way of modeling foreach makes it rather difficult.
Adds a test for brackward branch merging an unknown value to the resu…