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.47k stars 514 forks source link

Native Crash occurs when using Generics Types #20731

Closed AlexanderEgorov closed 4 months ago

AlexanderEgorov commented 4 months ago

Hello,

We encountered a strange crash in our .NET MAUI application. It seems there is a problem with generic types. The example and stack trace is provided below.

The issue can be reproduced only on iOS when the application is built in Release mode (no matter whether Llvm is enabled or not). It crashes both on the simulator and on a real device.

Example Project

_DXMauiApp-GenericTypes.zip

Steps to Reproduce

  1. Build the attached project under Release configuration
  2. Run the project on iPhone 15 simulator (ios 17.2)
  3. Click the "Local DistinctOfOrdered - crash" button.

Expected Behavior

The application is not crashed.

Actual Behavior

The application is crashed.

Stacktrace Stacktrace.txt ``` ================================================================= Native Crash Reporting ================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. ================================================================= ================================================================= Native stacktrace: ================================================================= 0x113538414 - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info 0x1134e8600 - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/libmonosgen-2.0.dylib : mono_handle_native_crash 0x11344fc10 - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug 0x1127d77e0 - /usr/lib/system/libsystem_platform.dylib : _sigtramp 0x102ec5008 - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/DXMauiApp : DXMauiApp_MainPage__c__OnClicked3b__1_0_string_string 0x102ec5008 - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/DXMauiApp : DXMauiApp_MainPage__c__OnClicked3b__1_0_string_string 0x102ec5b5c - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/DXMauiApp : DXMauiApp_Helper_FuncEqualityComparerStruct_1_V_REF_Equals_V_REF_V_REF ... ================================================================= Basic Fault Address Reporting ================================================================= Memory around native instruction pointer (0x1069daf30):0x1069daf20 10 82 37 91 01 36 41 f9 22 fc 43 93 00 00 02 8b ..7..6A.".C..... 0x1069daf30 00 00 40 39 fe 00 80 d2 22 00 1e 0a 21 00 80 d2 ..@9...."...!... 0x1069daf40 21 20 c2 1a 00 00 01 0a 40 00 00 b5 18 00 80 d2 ! ......@....... 0x1069daf50 f7 03 18 aa 98 01 00 b4 e0 03 17 aa e1 03 1a aa ................ ================================================================= Managed Stacktrace: ================================================================= at System.Collections.Comparer:Compare <0x00120> at <>c:b__1_0 <0x00097> at FuncEqualityComparerStruct`1:Equals <0x000db> at System.Object:runtime_invoke_dynamic <0x00127> at <0xffffffff> at System.Object:__icall_wrapper_mono_gsharedvt_constrained_call <0x00007> at d__0`2:MoveNext <0x005c7> at System.Collections.Generic.LargeArrayBuilder`1:AddRange <0x00103> at System.Collections.Generic.EnumerableHelpers:ToArray <0x0013f> at System.Linq.Enumerable:ToArray <0x00087> at DXMauiApp.MainPage:OnClicked3 <0x0023f> at Microsoft.Maui.Controls.Button:Microsoft.Maui.Controls.Internals.IButtonElement.PropagateUpClicked <0x000bf> at Microsoft.Maui.Controls.ButtonElement:ElementClicked <0x001b3> at Microsoft.Maui.Controls.Button:SendClicked <0x00083> ... ================================================================= Native Crash Reporting ================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. ================================================================= An error has occurred in the native fault reporting. Some diagnostic information will be unavailable. ================================================================= Native stacktrace: ================================================================= 0x113538414 - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info 0x1134e8600 - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/libmonosgen-2.0.dylib : mono_handle_native_crash 0x11344fc10 - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug 0x1127d77e0 - /usr/lib/system/libsystem_platform.dylib : _sigtramp 0x102ec5008 - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/DXMauiApp : DXMauiApp_MainPage__c__OnClicked3b__1_0_string_string 0x102ec5008 - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/DXMauiApp : DXMauiApp_MainPage__c__OnClicked3b__1_0_string_string 0x102ec5b5c - /Users/egorov/Library/Developer/CoreSimulator/Devices/53CBC8CE-1329-4871-9AC7-46DEAC455278/data/Containers/Bundle/Application/03AEEE0B-08DC-4853-95AE-110773A2C0BC/DXMauiApp.app/DXMauiApp : DXMauiApp_Helper_FuncEqualityComparerStruct_1_V_REF_Equals_V_REF_V_REF ... Exiting early due to double fault. ```

Environment

Version information ``` Xcode 15.3 iPhone 15 Simulator (iOS 17.2) dotnet version: 8.0.300 dotnet workload: maui-ios: Manifest Version: 8.0.21/8.0.100 Installation Source: SDK 8.0.300 ```
rolfbjarne commented 4 months ago

I can reproduce.

This only happens when the interpreter is disabled (which happens by default for Release builds).

This means that a workaround is to enable the interpreter:

<PropertyGroup>
    <UseInterpreter>true</UseInterpreter>
</PropertyGroup>

Crash:

=================================================================
    Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================
    0x117004414 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
    0x116fb4600 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_handle_native_crash
    0x116f1bc10 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
    0x1152877e0 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    0x106789158 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : DXMauiApp_MainPage__c__OnClicked3b__1_0_string_string
    0x106789158 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : DXMauiApp_MainPage__c__OnClicked3b__1_0_string_string
    0x1067895dc - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : DXMauiApp_Helper_FuncEqualityComparerStruct_1_V_REF_Equals_V_REF_V_REF
    0x10a510c98 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr
    0x116f1eef0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
    0x1170d9d20 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_runtime_invoke_checked
    0x116f63be0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_gsharedvt_constrained_call
    0x10a516b70 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : wrapper_managed_to_native_object___icall_wrapper_mono_gsharedvt_constrained_call_intptr_intptr_intptr_intptr_intptr_intptr
    0x10678e570 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : DXMauiApp_Helper__DistinctOfOrderedd__0_2_T_GSHAREDVT_C_GSHAREDVT_MoveNext
    0x10839df24 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : System_Collections_Generic_LargeArrayBuilder_1_T_REF_AddRange_System_Collections_Generic_IEnumerable_1_T_REF
    0x10839e8e0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : System_Collections_Generic_EnumerableHelpers_ToArray_T_REF_System_Collections_Generic_IEnumerable_1_T_REF
    0x1083b06a8 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : System_Linq_Enumerable_ToArray_TSource_REF_System_Collections_Generic_IEnumerable_1_TSource_REF
    0x106786fd0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : DXMauiApp_MainPage_OnClicked3_object_System_EventArgs
    0x106cc5330 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : Microsoft_Maui_Controls_Button_Microsoft_Maui_Controls_Internals_IButtonElement_PropagateUpClicked
    0x106ccae84 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : Microsoft_Maui_Controls_ButtonElement_ElementClicked_Microsoft_Maui_Controls_VisualElement_Microsoft_Maui_Controls_Internals_IButtonElement
    0x106cc4ec4 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : Microsoft_Maui_Controls_Button_SendClicked
    0x106cc89a0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : Microsoft_Maui_Controls_Button_Microsoft_Maui_IButton_Clicked
    0x10763a590 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : Microsoft_Maui_Handlers_ButtonHandler_ButtonEventProxy_OnButtonTouchUpInside_object_System_EventArgs
    0x10b2d6260 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : UIKit_UIControlEventProxy_Activated
    0x10a510c98 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr
    0x116f1eef0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
    0x1170dad34 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_runtime_try_invoke
    0x1170dddac - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_runtime_invoke
    0x10bdaf204 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : _ZL30native_to_managed_trampoline_9P11objc_objectP13objc_selectorPP11_MonoMethodj
    0x10bdfff50 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : -[UIKit_UIControlEventProxy BridgeSelector]
    0x1852f5198 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : -[UIApplication sendAction:to:from:forEvent:]
    0x184c0fe98 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : -[UIControl sendAction:to:forEvent:]
    0x184c101dc - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : -[UIControl _sendActionsForEvents:withEvent:]
    0x184c0cd1c - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : -[UIButton _sendActionsForEvents:withEvent:]
    0x184c0ef18 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : -[UIControl touchesEnded:withEvent:]
    0x185328a2c - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : -[UIWindow _sendTouchesForEvent:]
    0x185329f10 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : -[UIWindow sendEvent:]
    0x18530998c - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : -[UIApplication sendEvent:]
    0x18538a5c0 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : __dispatchPreprocessedEventFromEventQueue
    0x18538d474 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : __processEventQueue
    0x185385e38 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : __eventFetcherSourceCallback
    0x1803f1f18 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
    0x1803f1e60 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSource0
    0x1803f15d0 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSources0
    0x1803ebcb8 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopRun
    0x1803eb5a4 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : CFRunLoopRunSpecific
    0x18e9fbae4 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices : GSEventRunModal
    0x1852f02e4 - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : -[UIApplication _run]
    0x1852f3f5c - /Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
    0x1163b7f00 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libxamarin-dotnet-debug.dylib : xamarin_UIApplicationMain
    0x10baec5a0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : wrapper_managed_to_native_UIKit_UIApplication_xamarin_UIApplicationMain_int_intptr_intptr_intptr_intptr_
    0x10b2a7254 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr
    0x10b2a753c - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : UIKit_UIApplication_Main_string___System_Type_System_Type
    0x106788bf8 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : DXMauiApp_Program_Main_string__
    0x10a510c98 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr
    0x116f1eef0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
    0x1170d9d20 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_runtime_invoke_checked
    0x1170e1300 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_runtime_exec_main_checked
    0x116f730b0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libmonosgen-2.0.dylib : mono_jit_exec
    0x1163fbb00 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/libxamarin-dotnet-debug.dylib : xamarin_main
    0x10be6f9d0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/9BDFDFE4-6694-45B3-8DFC-EF8040AB7200/data/Containers/Bundle/Application/AA4F13FA-6E5F-4682-B8C5-E37BFA501E88/DXMauiApp.app/DXMauiApp : main
    0x115351544 - Unknown
    0x1155520e0 - Unknown
    0xda4e000000000000 - Unknown

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x10a29ef30):0x10a29ef20  10 42 11 91 01 36 41 f9 22 fc 43 93 00 00 02 8b  .B...6A.".C.....
0x10a29ef30  00 00 40 39 fe 00 80 d2 22 00 1e 0a 21 00 80 d2  ..@9...."...!...
0x10a29ef40  21 20 c2 1a 00 00 01 0a 40 00 00 b5 18 00 80 d2  ! ......@.......
0x10a29ef50  f7 03 18 aa 98 01 00 b4 e0 03 17 aa e1 03 1a aa  ................

=================================================================
    Managed Stacktrace:
=================================================================
      at System.Collections.Comparer:Compare <0x00120>
      at <>c:<OnClicked3>b__1_0 <0x00097>
      at FuncEqualityComparerStruct`1:Equals <0x000db>
      at System.Object:runtime_invoke_dynamic <0x00127>
      at <unknown> <0xffffffff>
      at System.Object:__icall_wrapper_mono_gsharedvt_constrained_call <0x00007>
      at <DistinctOfOrdered>d__0`2:MoveNext <0x0062f>
      at System.Collections.Generic.LargeArrayBuilder`1:AddRange <0x00103>
      at System.Collections.Generic.EnumerableHelpers:ToArray <0x0013f>
      at System.Linq.Enumerable:ToArray <0x00087>
      at DXMauiApp.MainPage:OnClicked3 <0x0029f>
      at Microsoft.Maui.Controls.Button:Microsoft.Maui.Controls.Internals.IButtonElement.PropagateUpClicked <0x000bf>
      at Microsoft.Maui.Controls.ButtonElement:ElementClicked <0x001b3>
      at Microsoft.Maui.Controls.Button:SendClicked <0x00083>
      at Microsoft.Maui.Controls.Button:Microsoft.Maui.IButton.Clicked <0x0008f>
      at ButtonEventProxy:OnButtonTouchUpInside <0x0010f>
      at UIKit.UIControlEventProxy:Activated <0x0006f>
      at System.Object:runtime_invoke_dynamic <0x00127>
      at <unknown> <0xffffffff>
      at UIKit.UIApplication:xamarin_UIApplicationMain <0x00007>
      at UIKit.UIApplication:UIApplicationMain <0x00063>
      at UIKit.UIApplication:Main <0x0013b>
      at DXMauiApp.Program:Main <0x00097>
      at System.Object:runtime_invoke_dynamic <0x00127>

I'm moving to dotnet/runtime, since this is most likely an issue in the AOT compiler.

rolfbjarne commented 4 months ago

This issue was moved to dotnet/runtime#103569