runtime: Crash in GetHashCode with generic record

Description

In a library, I’ve a generic record that inherits from another generic record https://github.com/unoplatform/uno.extensions/blob/450d19f8fd9d4c53f327e5ecddbeeb50f86b020f/src/Uno.Extensions.Reactive/Operators/FeedToListFeedAdapter.cs#L14, but as soon as I try to use an instance of that record in a Dictionary my app is crashing.

Reproduction Steps

Unfortunately I was not able to create a repro for that issue. But here are the working (with an explicit GetHashCode) and failing version of my app on iOS. working-Commerce.iOS.app.zip crashing-Commerce.iOS.app.zip .

Expected behavior

No crash 😃

Actual behavior

Using mono for Android and iOS the app is crashing while using the same library is working fine on UWP / WinUI. Didn’t test WebAssembly.

On Android I get a SIGABRT

[libc] Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 5768 (mmerce.Commerce), pid 5768 (mmerce.Commerce)

On iOS I get that stack trace:


=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at Uno.Extensions.Reactive.Operators.FeedToListFeedAdapter`1:GetHashCode <0x0004a>
	  at Uno.Extensions.Reactive.ListStateImpl`1:GetHashCode <0x0004a>
	  at System.Collections.Generic.ObjectEqualityComparer`1:GetHashCode <0x000aa>
	  at Uno.Extensions.Reactive.Operators.ListFeedToFeedAdapter`1:GetHashCode <0x0012c>
	  at System.Collections.Generic.Dictionary`2:FindEntry <0x001e6>
	  at System.Collections.Generic.Dictionary`2:TryGetValue <0x0008a>
	  at Uno.Extensions.Reactive.Core.StateStore:GetOrCreateState <0x0045a>
	  at Uno.Extensions.Reactive.Core.SourceContext:GetOrCreateStateCore <0x00375>
	  at Uno.Extensions.Reactive.Core.SourceContext:GetOrCreateListState <0x000fa>
	  at Uno.Extensions.Reactive.Bindings.BindableListFeed`1:.ctor <0x00132>
	  at BindableDealsViewModel:.ctor <0x006b2>
	  at <Module>:runtime_invoke_void__this___object_object_object <0x001ff>
	  at <unknown> <0xffffffff>
	  at System.Reflection.RuntimeConstructorInfo:InternalInvoke <0x00100>
	  at System.Reflection.RuntimeConstructorInfo:InternalInvoke <0x0029a>
	  at System.Reflection.RuntimeConstructorInfo:DoInvoke <0x004ea>
	  at System.Reflection.RuntimeConstructorInfo:Invoke <0x0009a>
	  at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver:VisitConstructor <0x0038d>
	  at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2:VisitCallSiteMain <0x00398>
	  at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver:VisitDisposeCache <0x000dd>
	  at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2:VisitCallSite <0x00564>
	  at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver:Resolve <0x00237>
	  at <>c__DisplayClass2_0:<RealizeService>b__0 <0x000d2>
	  at Microsoft.Extensions.DependencyInjection.ServiceProvider:GetService <0x001eb>
	  at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope:GetService <0x00122>
	  at <CreateViewModel>d__8:MoveNext <0x00c4d>
	  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00202>
	  at Uno.Extensions.Navigation.Navigators.ControlNavigator:CreateViewModel <0x0029a>
	  at <InitializeCurrentView>d__9:MoveNext <0x006da>
	  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x0021a>
	  at Uno.Extensions.Navigation.Navigators.ControlNavigator`1:InitializeCurrentView <0x002bc>
	  at <NavigateForwardAsync>d__10:MoveNext <0x016a2>
	  at MoveNextRunner:InvokeMoveNext <0x000ab>
	  at System.Threading.ExecutionContext:RunInternal <0x00585>
	  at System.Threading.ExecutionContext:Run <0x00092>
	  at MoveNextRunner:Run <0x001aa>
	  at System.Threading.Tasks.AwaitTaskContinuation:InvokeAction <0x00093>
	  at System.Threading.Tasks.AwaitTaskContinuation:RunCallback <0x00153>
	  at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run <0x0013a>
	  at System.Threading.Tasks.Task:FinishContinuations <0x006ae>
	  at System.Threading.Tasks.Task:FinishStageThree <0x0015a>
	  at System.Threading.Tasks.Task`1:TrySetResult <0x0026a>
	  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult <0x002da>
	  at <Show>d__14:MoveNext <0x010ea>
	  at MoveNextRunner:InvokeMoveNext <0x000ab>
	  at System.Threading.ExecutionContext:RunInternal <0x00585>
	  at System.Threading.ExecutionContext:Run <0x00092>
	  at MoveNextRunner:Run <0x001aa>
	  at System.Threading.Tasks.AwaitTaskContinuation:InvokeAction <0x00093>
	  at System.Threading.Tasks.AwaitTaskContinuation:RunCallback <0x00153>
	  at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run <0x0013a>
	  at System.Threading.Tasks.Task:FinishContinuations <0x006ae>
	  at System.Threading.Tasks.Task:FinishStageThree <0x0015a>
	  at System.Threading.Tasks.Task`1:TrySetResult <0x00262>
	  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult <0x002e2>
	  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult <0x0014a>
	  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetResult <0x00082>
	  at <EnsurePageLoaded>d__15:MoveNext <0x006ba>
	  at MoveNextRunner:InvokeMoveNext <0x000ab>
	  at System.Threading.ExecutionContext:RunInternal <0x00585>
	  at System.Threading.ExecutionContext:Run <0x00092>
	  at MoveNextRunner:Run <0x001aa>
	  at System.Threading.Tasks.AwaitTaskContinuation:InvokeAction <0x00093>
	  at System.Threading.Tasks.AwaitTaskContinuation:RunCallback <0x00153>
	  at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run <0x0013a>
	  at System.Threading.Tasks.Task:FinishContinuations <0x006ae>
	  at System.Threading.Tasks.Task:FinishStageThree <0x0015a>
	  at System.Threading.Tasks.Task`1:TrySetResult <0x0022a>
	  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult <0x002b2>
	  at <EnsureLoaded>d__6:MoveNext <0x0088a>
	  at MoveNextRunner:InvokeMoveNext <0x000ab>
	  at System.Threading.ExecutionContext:RunInternal <0x00585>
	  at System.Threading.ExecutionContext:Run <0x00092>
	  at MoveNextRunner:Run <0x001aa>
	  at System.Threading.Tasks.AwaitTaskContinuation:InvokeAction <0x00093>
	  at System.Threading.Tasks.AwaitTaskContinuation:RunCallback <0x00153>
	  at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run <0x0013a>
	  at System.Threading.Tasks.Task:FinishContinuations <0x006ae>
	  at System.Threading.Tasks.Task:FinishStageThree <0x0015a>
	  at System.Threading.Tasks.Task`1:TrySetResult <0x0022a>
	  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult <0x002b2>
	  at System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1:SetResult <0x000a2>
	  at <ExecuteAsync>d__0`1:MoveNext <0x006f2>
	  at MoveNextRunner:InvokeMoveNext <0x000ab>
	  at System.Threading.ExecutionContext:RunInternal <0x00585>
	  at System.Threading.ExecutionContext:Run <0x00092>
	  at MoveNextRunner:Run <0x001aa>
	  at System.Threading.Tasks.AwaitTaskContinuation:InvokeAction <0x00093>
	  at System.Threading.Tasks.AwaitTaskContinuation:RunCallback <0x00153>
	  at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run <0x0013a>
	  at System.Threading.Tasks.Task:FinishContinuations <0x006ae>
	  at System.Threading.Tasks.Task:FinishStageThree <0x0015a>
	  at System.Threading.Tasks.Task`1:TrySetResult <0x0022a>
	  at System.Threading.Tasks.TaskCompletionSource`1:TrySetResult <0x00092>
	  at System.Threading.Tasks.TaskCompletionSource`1:SetResult <0x0007a>
	  at <<ExecuteAsync>b__0>d:MoveNext <0x0046a>
	  at System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start <0x0020a>
	  at <>c__DisplayClass0_0`1:<ExecuteAsync>b__0 <0x0014a>
	  at <>c__DisplayClass6_0:<TryEnqueue>b__0 <0x0006f>
	  at Uno.UI.Dispatching.CoreDispatcher:InvokeOperation <0x00460>
	  at Uno.UI.Dispatching.CoreDispatcher:InvokeOperationSafe <0x0008a>
	  at Uno.UI.Dispatching.CoreDispatcher:DispatchItems <0x0070a>
	  at CoreFoundation.DispatchQueue:static_dispatcher_to_managed <0x0032f>
	  at CoreFoundation.DispatchQueue:static_dispatcher_to_managed <0x0010a>
	  at <unknown> <0xffffffff>
	  at UIKit.UIApplication:UIApplicationMain <0x00254>
	  at UIKit.UIApplication:Main <0x002da>
	  at Commerce.iOS.Application:Main <0x00092>
	  at <Module>:runtime_invoke_void_object <0x001a8>
=================================================================
The app has been terminated.
x

Regression?

No response

Known Workarounds

I’ve implemented my own GetHashCode https://github.com/unoplatform/uno.extensions/blob/450d19f8fd9d4c53f327e5ecddbeeb50f86b020f/src/Uno.Extensions.Reactive/Operators/FeedToListFeedAdapter.cs#L96

Configuration

Dev machine:

  • Win 11 21H2

  • VS 2022 17.3 pre 1.1
    Microsoft Visual Studio Enterprise 2022
    Version 17.3.0 Preview 1.1
    VisualStudio.17.Preview/17.3.0-pre.1.1+32519.111
    Microsoft .NET Framework
    Version 4.8.04161
    
    Installed Version: Enterprise
    
    Visual C++ 2022   00476-80000-00000-AA270
    Microsoft Visual C++ 2022
    
    .NET Core Debugging with WSL   1.0
    .NET Core Debugging with WSL
    
    ASP.NET and Web Tools 2019   17.3.122.33185
    ASP.NET and Web Tools 2019
    
    Azure App Service Tools v3.0.0   17.3.122.33185
    Azure App Service Tools v3.0.0
    
    Azure Functions and Web Jobs Tools   17.3.122.33185
    Azure Functions and Web Jobs Tools
    
    C# Tools   4.3.0-1.22254.1+9919d7e7bd753404a5d2328e5e3fb2de635169f3
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
    
    Common Azure Tools   1.10
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
    
    Extensibility Message Bus   1.2.6 (master@34d6af2)
    Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
    
    Microsoft Azure Tools for Visual Studio   2.9
    Support for Azure Cloud Services projects
    
    Microsoft JVM Debugger   1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
    
    Mono Debugging for Visual Studio   17.3.11 (4f73250)
    Support for debugging Mono processes with Visual Studio.
    
    Node.js Tools   1.5.40427.1 Commit Hash:d6dd02cc1b56ad1cb24b4ef0c48a81a985bbc64c
    Adds support for developing and debugging Node.js apps in Visual Studio
    
    NuGet Package Manager   6.3.0
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
    
    Razor (ASP.NET Core)   17.0.0.2222701+751db1ebea5e6a9ecc7fa57fe447180422afa610
    Provides languages services for ASP.NET Core Razor.
    
    SQL Server Data Tools   17.0.62204.01010
    Microsoft SQL Server Data Tools
    
    TypeScript Tools   17.0.10420.2001
    TypeScript Tools for Microsoft Visual Studio
    
    UnoPlatformPackage Extension   1.0
    UnoPlatformPackage Visual Studio Extension Detailed Info
    
    Visual Basic Tools   4.3.0-1.22254.1+9919d7e7bd753404a5d2328e5e3fb2de635169f3
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
    
    Visual F# Tools   17.1.0-beta.22178.3+6da0245a7ce4bb8483b8d1f2993c8ecaea967ad9
    Microsoft Visual F# Tools
    
    Visual Studio IntelliCode   2.2
    AI-assisted development for Visual Studio.
    
    VisualStudio.DeviceLog   1.0
    Information about my package
    
    VisualStudio.Mac   1.0
    Mac Extension for Visual Studio
    
    VSPackage Extension   1.0
    VSPackage Visual Studio Extension Detailed Info
    
    Xamarin   17.3.0.151 (d17-3-p1.1@5a59bfa)
    Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
    
    Xamarin Designer   17.3.0.33 (remotes/origin/d17-3-1@9c0d11a29)
    Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
    
    Xamarin Templates   17.2.15 (2e3b60e)
    Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
    
    Xamarin.Android SDK   12.3.99.58 (main/64b22fc)
    Xamarin.Android Reference Assemblies and MSBuild support.
        Mono: adf1bc4
        Java.Interop: xamarin/java.interop/release/6.0.3xx@2a882d2d
        ProGuard: Guardsquare/proguard/v7.0.1@912d149
        SQLite: xamarin/sqlite/3.38.2@7b1e016
        Xamarin.Android Tools: xamarin/xamarin-android-tools/main@fc3c2ac
    
    
    Xamarin.iOS and Xamarin.Mac SDK   15.11.0.183 (f8314a435)
    Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
    

Mac:

  • VS for MAC 2019 v8.10.22 build 11
    === Visual Studio Enterprise 2019 for Mac ===
    
    Version 8.10.22 (build 11)
    Installation UUID: eac49913-0823-40de-a49d-50b6a14dc49f
    	GTK+ 2.24.23 (Raleigh theme)
    	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
    
    	Package version: 612000174
    
    === Mono Framework MDK ===
    
    Runtime:
    	Mono 6.12.0.174 (2020-02/adf1bc4335d) (64-bit)
    	Package version: 612000174
    
    === Roslyn (Language Service) ===
    
    3.10.0-4.21269.26+029847714208ebe49668667c60ea5b0a294e0fcb
    
    === NuGet ===
    
    Version: 5.9.0.7134
    
    === .NET SDK (x64) ===
    
    SDK: /usr/local/share/dotnet/sdk/5.0.407/Sdks
    SDK Versions:
    	5.0.407
    	5.0.404
    	5.0.403
    	5.0.400
    	5.0.302
    	5.0.103
    	5.0.100
    	3.1.418
    	3.1.416
    	3.1.415
    	3.1.412
    	3.1.411
    	3.1.406
    	3.1.302
    	3.1.200
    MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks
    
    === .NET Core Runtime ===
    
    Runtime: /usr/local/share/dotnet/dotnet
    Runtime Versions:
    	5.0.16
    	5.0.13
    	5.0.12
    	5.0.9
    	5.0.8
    	5.0.3
    	5.0.0
    	3.1.24
    	3.1.22
    	3.1.21
    	3.1.18
    	3.1.17
    	3.1.12
    	3.1.6
    	3.1.2
    	2.1.23
    	2.1.20
    	2.1.17
    	2.1.16
    
    === .NET Core 3.1 SDK ===
    
    SDK: 3.1.418
    
    === .NET 5.0 SDK ===
    
    SDK: 5.0.407
    
    === Xamarin.Profiler ===
    
    Version: 1.6.13.11
    Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
    
    === Updater ===
    
    Version: 11
    
    === Xamarin.Android ===
    
    Version: 12.2.4.3 (Visual Studio Enterprise)
    Commit: xamarin-android/d17-1/fc1125e
    Android SDK: /Users/david/Library/Developer/Xamarin/android-sdk-macosx
    	Supported Android versions:
    		8.0 (API level 26)
    
    SDK Tools Version: 26.1.1
    SDK Platform Tools Version: 29.0.5
    SDK Build Tools Version: 29.0.2
    
    Build Information: 
    Mono: adf1bc4
    Java.Interop: xamarin/java.interop/d17-1@7ac33610
    ProGuard: Guardsquare/proguard/v7.0.1@912d149
    SQLite: xamarin/sqlite/3.37.1@0893b3b
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-1@db125a7
    
    === Eclipse Temurin JDK ===
    
    Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home
    1.8.0.302
    Android Designer EPL code available here:
    https://github.com/xamarin/AndroidDesigner.EPL
    
    === Android SDK Manager ===
    
    Version: 16.10.0.13
    Hash: 1b81df5
    Branch: remotes/origin/d16-10
    Build date: 2021-11-12 00:17:32 UTC
    
    === Android Device Manager ===
    
    Version: 16.10.0.15
    Hash: 89dcc0b
    Branch: remotes/origin/d16-10
    Build date: 2021-11-12 00:17:52 UTC
    
    === Apple Developer Tools ===
    
    Xcode 13.3 (20102)
    Build 13E113
    
    === Xamarin.Mac ===
    
    Version: 8.8.0.3 (Visual Studio Enterprise)
    Hash: eb7f8ed35
    Branch: xcode13.3
    Build date: 2022-03-30 03:16:09-0400
    
    === Xamarin.iOS ===
    
    Version: 15.9.0.100 (Visual Studio Enterprise)
    Hash: cf971a68e
    Branch: main
    Build date: 2022-03-31 03:15:41-0400
    
    === Xamarin Designer ===
    
    Version: 16.11.0.60
    Hash: 56f9b80b0
    Branch: remotes/origin/d16-11
    Build date: 2021-12-15 01:44:16 UTC
    
    === Build Information ===
    
    Release ID: 810220011
    Git revision: 16b49eb779f7def4523bbc8f4407628cf8dbb4b5
    Build date: 2022-04-07 05:04:03-04
    Build branch: release-8.10
    
    === Operating System ===
    
    Mac OS X 12.3.0
    Darwin 21.4.0 Darwin Kernel Version 21.4.0
    	Mon Feb 21 20:34:37 PST 2022
    	root:xnu-8020.101.4~2/RELEASE_X86_64 x86_64
    
    
    
  • Simulator: iPad pro 5th gen iOS 15.4

Other information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (11 by maintainers)

Commits related to this issue

Most upvoted comments

@spouliot @ivanpovazan

Indeed, I didn’t scroll the log enough:

1>  MTouch: 2022-08-02T10:45:57.3782861-04:00 - Logging messages
1>  /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch @/Users/david/Library/Caches/Xamarin/mtbs/builds/Commerce.iOS/fa47e299a41d206017070f669485f2d73de2e05cd5e6e63edb345ccc4da85e2f/obj/iPhone/Release/response-file.rsp "--setenv=MONO_GC_PARAMS=soft-heap-limit=512m,nursery-size=64m,evacuation-threshold=66,major=marksweep,concurrent-sweep" 
1>  Xamarin.iOS 15.10.0.5 (d17-2: 96b3edb6d) using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk
1>  AOT Compilation exited with code 134, command:
1>  MONO_PATH=/Users/david/Library/Caches/Xamarin/mtbs/builds/Commerce.iOS/fa47e299a41d206017070f669485f2d73de2e05cd5e6e63edb345ccc4da85e2f/obj/iPhone/Release/mtouch-cache/3-Build /Library/Frameworks/Xamarin.iOS.framework/Versions/15.10.0.5/bin/arm64-darwin-mono-sgen --debug --llvm -O=gsharedvt -O=-float32 --aot=mtriple=arm64-ios,data-outfile=/Users/david/Library/Caches/Xamarin/mtbs/builds/Commerce.iOS/fa47e299a41d206017070f669485f2d73de2e05cd5e6e63edb345ccc4da85e2f/obj/iPhone/Release/mtouch-cache/arm64/Uno.Extensions.Reactive.aotdata.arm64,static,asmonly,direct-icalls,full,readonly-value=ObjCRuntime.Runtime.Arch=i4/0,nodebug,dwarfdebug,msym-dir=/Users/david/Library/Caches/Xamarin/mtbs/builds/Commerce.iOS/fa47e299a41d206017070f669485f2d73de2e05cd5e6e63edb345ccc4da85e2f/obj/iPhone/Release/mtouch-cache/3-Build/Msym,llvm-path=/Library/Frameworks/Xamarin.iOS.framework/Versions/15.10.0.5/LLVM/bin/,outfile=/Users/david/Library/Caches/Xamarin/mtbs/builds/Commerce.iOS/fa47e299a41d206017070f669485f2d73de2e05cd5e6e63edb345ccc4da85e2f/obj/iPhone/Release/mtouch-cache/arm64/Uno.Extensions.Reactive.dll.s,llvm-outfile=/Users/david/Library/Caches/Xamarin/mtbs/builds/Commerce.iOS/fa47e299a41d206017070f669485f2d73de2e05cd5e6e63edb345ccc4da85e2f/obj/iPhone/Release/mtouch-cache/arm64/Uno.Extensions.Reactive.dll-llvm.o /Users/david/Library/Caches/Xamarin/mtbs/builds/Commerce.iOS/fa47e299a41d206017070f669485f2d73de2e05cd5e6e63edb345ccc4da85e2f/obj/iPhone/Release/mtouch-cache/3-Build/Uno.Extensions.Reactive.dll
1>  Mono Ahead of Time compiler - compiling assembly /Users/david/Library/Caches/Xamarin/mtbs/builds/Commerce.iOS/fa47e299a41d206017070f669485f2d73de2e05cd5e6e63edb345ccc4da85e2f/obj/iPhone/Release/mtouch-cache/3-Build/Uno.Extensions.Reactive.dll
1>  AOTID 2604B0B2-C0F0-4563-CDC2-B9E379462159
1>  * Assertion at /Users/builder/jenkins/workspace/archive-mono/2020-02/ios/release/mono/mini/method-to-ir.c:7241, condition `is_ok (error)' not met, function:mono_method_to_ir, VAR 1 (TItem_REF) cannot be expanded in this context with 1 instantiations
1>  
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(235,3): error MT3001: Could not AOT the assembly '/Users/david/Library/Caches/Xamarin/mtbs/builds/Commerce.iOS/fa47e299a41d206017070f669485f2d73de2e05cd5e6e63edb345ccc4da85e2f/obj/iPhone/Release/mtouch-cache/3-Build/Uno.Extensions.Reactive.dll'

So yes it’s the same assertion that fails

@dr1rrb MT3001 is a catch-all error code of Xamarin.iOS when running the AOT compiler. Basically it means “we called the AOT compiler” but we can’t find any output.

The most common case is that the AOT compiler crashed. Your build logs should have some trace of that crash. The Mac’s Console.app should also have a crash report for the compiler.

hey @dr1rrb, if it is failing with the same error message (mentioned above) in the fullAOT build - device build, then it is most likely the same issue. Regarding the simulator, it is a bit more difficult to trigger the actual call which causes the problem, so the AOT build should be your measuring (repro) point.

FYI, to workaround the build issue we do have on projects (including our sample “commerce app”) I had to push my workaround further by converting my objects to class instead of record (and implement the GetHashCode and the Equals manually). So even if for me (which is not used to deal with that kind of issues) it’s not “natural” that a runtime bug can be reproduced at build time with AOT, everything tends to show that you are right … which is a good news 👍

Thanks for your support

@SamMonoRT, I don’t think so

Hey @ivanpovazan I just tried to build the “Commerce Sample App” with the version “2.2.0-dev.70” (which contains my workaround for the GetHashCode) and I noticed that the build (release - device) also fails on the AOT step. But if I target an emulator (still in release, but without AOT), the build succeed … and my original bug (crash at runtime) is fixed.

I’m wondering if it’s not 2 different issues.

Any thoughts?

(Going to try with our “simple repro”)

The most common case is that the AOT compiler crashed. Your build logs should have some trace of that crash. The Mac’s Console.app should also have a crash report for the compiler.

The build log in VisualStudio should have a line stating the cause of the failure. From what I described above that line should be something like:

2022-07-28 19:46:08.933000+0200 Commerce.iOS[18142:400335] error: * Assertion at /Users/builder/jenkins/workspace/archive-mono/2020-02/ios/release/mono/mini/method-to-ir.c:7241, condition `is_ok (error)' not met, function:mono_method_to_ir, VAR 1 (TItem_REF) cannot be expanded in this context with 1 instantiations

@dr1rrb it would be great if you could confirm this.

Yes the crash happen in both debug and release.

BTW, if it helps you, the source code of the app is here https://github.com/unoplatform/Uno.Samples/tree/master/reference/Uno.Extensions.Commerce (it’s a sample app, you can pass the login page just by entering dummy content)

In the app source code, the crash is caused by this line: https://github.com/unoplatform/Uno.Samples/blob/d29881785845b484480fc0c125a210c1cc1d5c0b/reference/Uno.Extensions.Commerce/Commerce/ViewModels/DealsViewModel.cs#L23 in the DealsViewModel for which we generate a nested class BindableDealsViewModel which will instantiate the BindableListFeed directly in its constructor :

Favorites = new global::Uno.Extensions.Reactive.Bindings.BindableListFeed<Commerce.Business.Models.Product>(
	nameof(Favorites),
	vm.Favorites ?? throw new NullReferenceException("The list feed property 'Favorites' is null. Public feeds properties must be initialized in the constructor."),
	ctx);

FYI In the sample project, the generated source code can be found here: image