Closed filipnavara closed 1 year ago
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.
Author: | filipnavara |
---|---|
Assignees: | - |
Labels: | `area-CodeGen-coreclr`, `untriaged` |
Milestone: | - |
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger See info in area-owners.md if you want to be subscribed.
Author: | filipnavara |
---|---|
Assignees: | - |
Labels: | `untriaged`, `os-ios`, `area-NativeAOT-coreclr` |
Milestone: | - |
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas See info in area-owners.md if you want to be subscribed.
This is bad IL. Generic variable token used non-generic method.
.class auto ansi nested assembly beforefieldinit Callback`1<(UIKit.UIGestureRecognizer) T>
extends UIKit.UIGestureRecognizer/Token
{
.class auto ansi sealed nested assembly __Registrar_Callbacks__
extends [System.Private.CoreLib]System.Object
{
.method public hidebysig static void
callback_2515_UIKit_UIGestureRecognizer_Callback_1_Activated(native int pobj,
native int sel,
native int p0,
native int* exception_gchandle) cil managed
...
IL_0048: unbox.any !0 <- Reference to generic variable in non-generic method
...
Is the __Registrar_Callbacks__
code auto-generated by some tool? It looks like a bug in that tool.
Is the
__Registrar_Callbacks__
code auto-generated by some tool? It looks like a bug in that tool.
Yes, it is - https://github.com/xamarin/xamarin-macios/pull/17828 - cc @rolfbjarne
It looks like it should have been unbox.any !T
or nothing at all. In fact, the PR was updated meanwhile and the places which emitted the unbox.any
now have a comment:
// We're calling the target method dynamically (using MethodBase.Invoke), so there's no
// need to check the type of the returned object, because MethodBase.Invoke will do type checks.
I rebuilt everything and looks like the latest version of the linked PR fixed the invalid IL that was generated.
Thanks for help!
Repro: 3168759622_ios-naot.zip