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.45k stars 511 forks source link

Entity Framework Core crashes on Xamarin iOS (Real Device) when entity contains many columns #12267

Closed spectraflex closed 3 years ago

spectraflex commented 3 years ago

Steps to Reproduce

Pls. Check out the Example Project https://github.com/spectraflex/XamarionIosEntityFrameworkCoreBug

  1. Setup an Xamarin ios Project with following Dependencies

    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core">
      <Version>5.0.8</Version>
    </PackageReference>
    <PackageReference Include="sqlite-net-pcl">
      <Version>1.7.335</Version>
    </PackageReference>
    <PackageReference Include="sqlite-net-sqlcipher">
      <Version>1.7.335</Version>
    </PackageReference>
    <PackageReference Include="System.ComponentModel.Annotations">
      <Version>5.0.0</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
  2. Create a Model with a long id Property and 9 double Properties ( or more )

    public class Model2
    {
        public long id { get; set; }
    
        public double yolo1 { get; set; }
        public double yolo2 { get; set; }
        public double yolo3 { get; set; }
        public double yolo4 { get; set; }
        public double yolo5 { get; set; }
        public double yolo6 { get; set; }
        public double yolo7 { get; set; }
        public double yolo8 { get; set; }
        public double yolo9 { get; set; }
    
    }
  3. Create a DbContext Class

    public class AppDbContext : DbContext
    {
        public DbSet<Model2> model2Set { get; set; }
    
        public AppDbContext()
        {
            SQLitePCL.Batteries_V2.Init();
    
            Database.OpenConnection();
            Database.EnsureCreated();
        }
    
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlite(new SqliteConnectionStringBuilder("Data Source=" + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "YOLO.db")) { Password = "1324" }.ToString());
        }
    }
  4. Try to Add Model2

            using(AppDbContext context = new AppDbContext())
            {
                var model2 = new Model2();
                context.model2Set.Add(model2);
                context.SaveChanges();
            }
  5. Run the app on a iOS device. (iPhone 11 pro max ios 14.6)

2021-07-28 10:31:24.609 App2[5016:1699479] 
Unhandled Exception:
System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) object <Module>:runtime_invoke_void__this___long_double_double_double_double_double_double_double_double_double (object,intptr,intptr,intptr)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
  at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936 
--- End of stack trace from previous location where exception was thrown ---
  at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow (System.Reflection.TargetInvocationException exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Utilities.cs:172 
  at System.Linq.Expressions.Interpreter.NewInstruction.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00026] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/NewInstruction.cs:39 
  at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00015] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Interpreter.cs:63 
  at System.Linq.Expressions.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) [0x0001c] in <26bd496943a145e18f2cd8379c502c52>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry+OriginalValues..ctor (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x00011] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.EnsureOriginalValues () [0x0000d] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntrySubscriber.SnapshotAndSubscribe (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0000f] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0008c] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState oldState, Microsoft.EntityFrameworkCore.EntityState newState, System.Boolean acceptChanges, System.Boolean modifyProperties) [0x0015d] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState entityState, System.Boolean acceptChanges, System.Boolean modifyProperties, System.Nullable`1[T] forceStateWhenUnknownKey) [0x00039] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode`1[TState] node) [0x0006d] in <490630622de1432a8c452c33119e98b5>:0 
  at (wrapper other) System.Object.gsharedvt_out()
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState] (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode`1[TState] node, System.Func`2[T,TResult] handleNode) [0x00000] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry rootEntry, Microsoft.EntityFrameworkCore.EntityState targetState, Microsoft.EntityFrameworkCore.EntityState storeGeneratedWithKeySetTargetState, System.Boolean forceStateWhenUnknownKey) [0x00017] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[TEntity].SetEntityState (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry, Microsoft.EntityFrameworkCore.EntityState entityState) [0x00018] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[TEntity].Add (TEntity entity) [0x0000f] in <490630622de1432a8c452c33119e98b5>:0 
  at App2.Application.Main (System.String[] args) [0x00028] in C:\source\repos\App2\App2\Main.cs:18 

Expected Behavior

context.model2Set.Add(model2); should work

Actual Behavior

context.model2Set.Add(model2);

Environment

Microsoft Visual Studio Enterprise 2019 (3)
Version 16.10.4
VisualStudio.16.Release/16.10.4+31515.178
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Enterprise

.NET Core Debugging with WSL 2   1.0
.NET Core Debugging with WSL 2

.NET Reflector Visual Studio Extension   11.0.0.2016
Integrates .NET Reflector into Visual Studio to allow you to seamlessly debug into third-party code and assemblies, even if you don't have the source code for them.

Visit www.reflector.net for more information.

Copyright © Red Gate Software Ltd 2008-2021.

ASP.NET and Web Tools 2019   16.10.526.50910
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019   16.10.526.50910
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.10.526.50910
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   16.10.526.50910
Azure Functions and Web Jobs Tools

C# Tools   3.10.0-4.21329.37+246ce641f04b67ef017655275d850bf902a8e40f
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.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.40423.1

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers   1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Mono Debugging for Visual Studio   16.10.15 (552afdf)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   5.10.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Progress Telerik UI for ASP.NET AJAX Extension   2021.2.614.2
Progress® Telerik® UI for ASP.NET AJAX Extension

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Razor (ASP.NET Core)   16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725
Provides languages services for ASP.NET Core Razor.

Snapshot Debugging Extension   1.0
Snapshot Debugging Visual Studio Extension Detailed Info

SQL Server Data Tools   16.0.62106.24090
Microsoft SQL Server Data Tools

Telerik Reporting Tools   3.44.11.0
Complete .NET Reporting Solution for Web, Mobile and Desktop Applications. For more information please visit http://www.telerik.com/reporting. 

TypeScript Tools   16.0.30429.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.10.0-4.21329.37+246ce641f04b67ef017655275d850bf902a8e40f
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   16.10.0-beta.21262.7+1b23bbeda88ea3cb9be9af777f4c99fa8663df81
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Foo   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   16.10.000.234 (d16-10@ecaf29b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.10.0.115 (remotes/origin/c750fbf1bde3c720d077f51640fe197c6dac7cbe@c750fbf1b)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.10.5 (355b57a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   11.3.0.4 (d16-10/ae14caf)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: b4a3858
    Java.Interop: xamarin/java.interop/d16-10@f39db25
    ProGuard: Guardsquare/proguard/v7.0.1@912d149
    SQLite: xamarin/sqlite/3.35.4@85460d3
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-10@c5732a0

Xamarin.iOS and Xamarin.Mac SDK   14.20.0.24 (c4b89cddb)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs (Exception)

2021-07-28 10:31:24.609 App2[5016:1699479] 
Unhandled Exception:
System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) object <Module>:runtime_invoke_void__this___long_double_double_double_double_double_double_double_double_double (object,intptr,intptr,intptr)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
  at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936 
--- End of stack trace from previous location where exception was thrown ---
  at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow (System.Reflection.TargetInvocationException exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Utilities.cs:172 
  at System.Linq.Expressions.Interpreter.NewInstruction.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00026] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/NewInstruction.cs:39 
  at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00015] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Interpreter.cs:63 
  at System.Linq.Expressions.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) [0x0001c] in <26bd496943a145e18f2cd8379c502c52>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry+OriginalValues..ctor (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x00011] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.EnsureOriginalValues () [0x0000d] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntrySubscriber.SnapshotAndSubscribe (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0000f] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0008c] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState oldState, Microsoft.EntityFrameworkCore.EntityState newState, System.Boolean acceptChanges, System.Boolean modifyProperties) [0x0015d] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState entityState, System.Boolean acceptChanges, System.Boolean modifyProperties, System.Nullable`1[T] forceStateWhenUnknownKey) [0x00039] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode`1[TState] node) [0x0006d] in <490630622de1432a8c452c33119e98b5>:0 
  at (wrapper other) System.Object.gsharedvt_out()
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState] (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode`1[TState] node, System.Func`2[T,TResult] handleNode) [0x00000] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry rootEntry, Microsoft.EntityFrameworkCore.EntityState targetState, Microsoft.EntityFrameworkCore.EntityState storeGeneratedWithKeySetTargetState, System.Boolean forceStateWhenUnknownKey) [0x00017] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[TEntity].SetEntityState (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry, Microsoft.EntityFrameworkCore.EntityState entityState) [0x00018] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[TEntity].Add (TEntity entity) [0x0000f] in <490630622de1432a8c452c33119e98b5>:0 
  at App2.Application.Main (System.String[] args) [0x00028] in C:\source\repos\App2\App2\Main.cs:18 
2021-07-28 10:31:24.610 App2[5016:1699479] Unhandled managed exception: Attempting to JIT compile method '(wrapper runtime-invoke) object <Module>:runtime_invoke_void__this___long_double_double_double_double_double_double_double_double_double (object,intptr,intptr,intptr)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
 (System.ExecutionEngineException)
  at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936 
--- End of stack trace from previous location where exception was thrown ---
  at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow (System.Reflection.TargetInvocationException exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Utilities.cs:172 
  at System.Linq.Expressions.Interpreter.NewInstruction.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00026] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/NewInstruction.cs:39 
  at System.Linq.Expressions.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) [0x0001c] in <26bd496943a145e18f2cd8379c502c52>:0 
  at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00015] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Interpreter.cs:63 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry+OriginalValues..ctor (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x00011] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.EnsureOriginalValues () [0x0000d] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntrySubscriber.SnapshotAndSubscribe (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0000f] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0008c] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState oldState, Microsoft.EntityFrameworkCore.EntityState newState, System.Boolean acceptChanges, System.Boolean modifyProperties) [0x0015d] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState entityState, System.Boolean acceptChanges, System.Boolean modifyProperties, System.Nullable`1[T] forceStateWhenUnknownKey) [0x00039] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode`1[TState] node) [0x0006d] in <490630622de1432a8c452c33119e98b5>:0 
  at (wrapper other) System.Object.gsharedvt_out()
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState] (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode`1[TState] node, System.Func`2[T,TResult] handleNode) [0x00000] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry rootEntry, Microsoft.EntityFrameworkCore.EntityState targetState, Microsoft.EntityFrameworkCore.EntityState storeGeneratedWithKeySetTargetState, System.Boolean forceStateWhenUnknownKey) [0x00017] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[TEntity].SetEntityState (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry, Microsoft.EntityFrameworkCore.EntityState entityState) [0x00018] in <490630622de1432a8c452c33119e98b5>:0 
  at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[TEntity].Add (TEntity entity) [0x0000f] in <490630622de1432a8c452c33119e98b5>:0 
  at App2.Application.Main (System.String[] args) [0x00028] in C:\source\repos\App2\App2\Main.cs:18 
=================================================================
    Native Crash Reporting
=================================================================
Got a abrt 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:
    0x102bf1070 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x102be7268 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x102bf05b8 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x1f61a829c - /usr/lib/system/libsystem_platform.dylib : <redacted>
=================================================================
    0x1f61ada9c - /usr/lib/system/libsystem_pthread.dylib : pthread_kill
    0x1b39f8b90 - /usr/lib/system/libsystem_c.dylib : abort
    0x102d82fb0 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : xamarin_find_protocol_wrapper_type
    0x102c51960 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : mono_pmip
    0x102be6c70 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x102be5644 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x102bdb3c8 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x1006d8bec - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x1004763cc - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100476404 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x10123646c - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x101229180 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x101206b2c - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x10121a534 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100c563ac - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100c4cd5c - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100c5cb9c - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100cb15ec - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100c474c4 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100c35bf0 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100c45d24 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x1006d976c - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100dd5be0 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100c35478 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100b64b28 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100b61d04 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x100311e6c - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x102bf8878 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : mono_pmip
    0x102cb238c - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : mono_pmip
    0x10069b600 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x102cb8640 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : mono_pmip
    0x102bd6dd0 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
    0x102d93b48 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : xamarin_log
    0x1aa279cf8 - /usr/lib/system/libdyld.dylib : <redacted>
    0x1003115b8 - /private/var/containers/Bundle/Application/DB53F674-4399-4CD6-BCB4-B8226CF941FA/App2.app/App2 : sqlite3_rekey_v2
=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x1d8761334):0x1d8761324  ff 0f 5f d6 c0 03 5f d6 10 29 80 d2 01 10 00 d4  .._..._..)......
0x1d8761334  03 01 00 54 7f 23 03 d5 fd 7b bf a9 fd 03 00 91  ...T.#...{......
0x1d8761344  b9 6e ff 97 bf 03 00 91 fd 7b c1 a8 ff 0f 5f d6  .n.......{...._.
0x1d8761354  c0 03 5f d6 90 29 80 d2 01 10 00 d4 03 01 00 54  .._..).........T
=================================================================
=================================================================
    Managed Stacktrace:
=================================================================
Launch succeeded. The app 'App2' has been successfully launched on 'iPhone'.

Example Project (If Possible)

https://github.com/spectraflex/XamarionIosEntityFrameworkCoreBug

spectraflex commented 3 years ago

Any idea to solve the issue? There was obviously an similar issue in the past which was closed. https://github.com/xamarin/xamarin-macios/issues/4984

spectraflex commented 3 years ago

Wrong IOS Build Configuration, for some unknown reason Mono wasn't enabled


<MtouchLink>None</MtouchLink>
<MtouchInterpreter>-all</MtouchInterpreter>
<MtouchFloat32>true</MtouchFloat32>`