xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.48k stars 514 forks source link

Some MonoTouchFixtures.ObjCRuntime.RegistrarTestGenerated tests fail on maccatalyst-arm64 and iossimulator-arm64 with the static registrar #19781

Open rolfbjarne opened 10 months ago

rolfbjarne commented 10 months ago

Repro:

Note: this only happens on arm64 (so run on an M1+ machine).

  1. Build repo
  2. Run monotouch-test like this:
make build run-bare -C tests/monotouch-test/dotnet/MacCatalyst BUILD_ARGUMENTS="/p:Registrar=managed-static" RUN_ARGUMENTS='--test MonoTouchFixtures.ObjCRuntime.RegistrarTestGenerated'

Fails like:

MonoTouchFixtures.ObjCRuntime.RegistrarTestGenerated
    [FAIL] NSNumberBindAs_Boolean_Array_Overrides : System.ExecutionEngineException : Attempting to JIT compile method 'bool ObjCRuntime.BindAs/<>c__DisplayClass3_0`2<bool, bool>:<ConvertNSArrayToManagedArray2>b__0 (ObjCRuntime.NativeHandle)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
           at Foundation.NSArray.ArrayFromHandleFunc[Boolean](NativeHandle handle, Func`2 createObject) in /Users/rolf/work/maccore/main/xamarin-macios/src/Foundation/NSArray.cs:line 372
           at ObjCRuntime.BindAs.ConvertNSArrayToManagedArray2[Boolean,Boolean](IntPtr nsarray,  convert1,  convert2) in /Users/rolf/work/maccore/main/xamarin-macios/src/ObjCRuntime/BindAs.cs:line 61
           at ObjCRuntime.BindAs.ConvertNSArrayToManagedArray[Boolean](IntPtr nsarray,  convert) in /Users/rolf/work/maccore/main/xamarin-macios/src/ObjCRuntime/BindAs.cs:line 45
           at MonoTouchFixtures.ObjCRuntime.RegistrarTestGenerated.BindAsTestClassGenerated.__Registrar_Callbacks__.callback_1378_MonoTouchFixtures_ObjCRuntime_RegistrarTestGenerated_BindAsTestClassGenerated_SetBooleanArray(IntPtr pobj, IntPtr sel, IntPtr p0, IntPtr* exception_gchandle)
           at MonoTouchFixtures.ObjCRuntime.RegistrarTestGenerated.NSNumberBindAs_Boolean_Array_Overrides() in /Users/rolf/work/maccore/main/xamarin-macios/tests/test-libraries/RegistrarTest.generated.cs:line 3136
           at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
           at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
    [FAIL] NSNumberBindAs_Byte_Array_Overrides : System.ExecutionEngineException : Attempting to JIT compile method 'byte ObjCRuntime.BindAs/<>c__DisplayClass3_0`2<byte, byte>:<ConvertNSArrayToManagedArray2>b__0 (ObjCRuntime.NativeHandle)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
           at Foundation.NSArray.ArrayFromHandleFunc[Byte](NativeHandle handle, Func`2 createObject) in /Users/rolf/work/maccore/main/xamarin-macios/src/Foundation/NSArray.cs:line 372
           at ObjCRuntime.BindAs.ConvertNSArrayToManagedArray2[Byte,Byte](IntPtr nsarray,  convert1,  convert2) in /Users/rolf/work/maccore/main/xamarin-macios/src/ObjCRuntime/BindAs.cs:line 61
           at ObjCRuntime.BindAs.ConvertNSArrayToManagedArray[Byte](IntPtr nsarray,  convert) in /Users/rolf/work/maccore/main/xamarin-macios/src/ObjCRuntime/BindAs.cs:line 45
           at MonoTouchFixtures.ObjCRuntime.RegistrarTestGenerated.BindAsTestClassGenerated.__Registrar_Callbacks__.callback_1300_MonoTouchFixtures_ObjCRuntime_RegistrarTestGenerated_BindAsTestClassGenerated_SetByteArray(IntPtr pobj, IntPtr sel, IntPtr p0, IntPtr* exception_gchandle)
           at MonoTouchFixtures.ObjCRuntime.RegistrarTestGenerated.NSNumberBindAs_Byte_Array_Overrides() in /Users/rolf/work/maccore/main/xamarin-macios/tests/test-libraries/RegistrarTest.generated.cs:line 1394
           at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
           at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
    [FAIL] NSNumberBindAs_Double_Array_Overrides : System.ExecutionEngineException : Attempting to JIT compile method 'double ObjCRuntime.BindAs/<>c__DisplayClass3_0`2<double, double>:<ConvertNSArrayToManagedArray2>b__0 (ObjCRuntime.NativeHandle)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
           at Foundation.NSArray.ArrayFromHandleFunc[Double](NativeHandle handle, Func`2 createObject) in /Users/rolf/work/maccore/main/xamarin-macios/src/Foundation/NSArray.cs:line 372
           at ObjCRuntime.BindAs.ConvertNSArrayToManagedArray2[Double,Double](IntPtr nsarray,  convert1,  convert2) in /Users/rolf/work/maccore/main/xamarin-macios/src/ObjCRuntime/BindAs.cs:line 61
           at ObjCRuntime.BindAs.ConvertNSArrayToManagedArray[Double](IntPtr nsarray,  convert) in /Users/rolf/work/maccore/main/xamarin-macios/src/ObjCRuntime/BindAs.cs:line 45
           at MonoTouchFixtures.ObjCRuntime.RegistrarTestGenerated.BindAsTestClassGenerated.__Registrar_Callbacks__.callback_1354_MonoTouchFixtures_ObjCRuntime_RegistrarTestGenerated_BindAsTestClassGenerated_SetDoubleArray(IntPtr pobj, IntPtr sel, IntPtr p0, IntPtr* exception_gchandle)
           at MonoTouchFixtures.ObjCRuntime.RegistrarTestGenerated.NSNumberBindAs_Double_Array_Overrides() in /Users/rolf/work/maccore/main/xamarin-macios/tests/test-libraries/RegistrarTest.generated.cs:line 2600
           at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
           at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
[...]
rolfbjarne commented 5 months ago

Filed a runtime issue: https://github.com/dotnet/runtime/issues/102728