Bug 59184 - MethodInfo.Invoke fails for generic methods with too many/too large arguments
Summary: MethodInfo.Invoke fails for generic methods with too many/too large arguments
Status: IN_PROGRESS
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler (show other bugs)
Version: XI 10.12 (d15-3)
Hardware: PC Windows
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Zoltan Varga
URL:
: 58424 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-09-01 18:40 UTC by Rob Kite
Modified: 2017-10-21 18:22 UTC (History)
7 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Rob Kite 2017-09-01 18:40:19 UTC
This one had me puzzled for most of the day. It would appear that inclusion of an enum in an Entity Framework Core data model can cause Xamarin.iOS to throw a JIT error / limitation message.

Annoyingly the issue isn't present in the simulator, and in my case at least also isn't present if the majority of other properties are removed (leaving the navigation properties and enum properties only). Have also tried setting Linker Behaviour to 'Don't Link' but this doesn't change the exception. I do have mtouch arguments set to '--linkskip=System.Core --linkskip=mscorlib' which has removed any issues with general Linq queries used in EFCore (a completely separate issue).


### Repro project
EFCore.Data - The EFCore implementation
EFCore.App - The iOS Application (which throws and exception when clicking 'Add Quotation' on a physical device)
EFCore.Console - A .NET Console App showing that the EFCore implementation is valid and works

Github link:
https://github.com/robkite/EFCore.App


### Repro steps
TO resolve the issue simply comment out the enum properties in the Quotation and User domain classes (PropertyType and Relation respectively) within the EFCore.Data project. However removing the majority of properties besides the enums and the navigation properties also seems to resolve the issue.

### Machine Environment
Microsoft Visual Studio Community 2017 
Version 15.3.0
VisualStudio.15.Release/15.3.0+26730.3
Microsoft .NET Framework
Version 4.7.02053

Installed Version: Community

Visual Basic 2017
Microsoft Visual Basic 2017

Visual C# 2017
Microsoft Visual C# 2017

Visual C++ 2017
Microsoft Visual C++ 2017

Visual F# 4.1 
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.8.00712.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30726.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   1.0
Provides languages services for ASP.NET Core Razor.

ASP.NET Template Engine 2017   15.0.30726.0
ASP.NET Template Engine 2017

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

Azure App Service Tools v3.0.0   15.0.30728.0
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.2.9000.1
Microsoft Azure Data Lake Tools for Visual Studio

Azure Data Lake Tools for Visual Studio   2.2.9000.1
Microsoft Azure Data Lake Tools for Visual Studio

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GhostDoc   5.6.17190.0
Generate XML Comments from your code, maintain clean and up-to-date documentation, produce help documentation in multiple formats, use intelligent source code Spell Checker in Visual Studio.

JavaScript Language Service   2.0
JavaScript Language Service

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure HDInsight Azure Node   2.2.9000.1
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.2.9000.1
Language service for Hive query

Microsoft Azure Stream Analytics Language Service   2.2.9000.1
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.50719.1

Microsoft Continuous Delivery Tools for Visual Studio   0.3
Simplifying the configuration of continuous build integration and continuous build delivery 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 MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   4.6.8-pre (ec7034f)
Support for debugging Mono processes with Visual Studio.

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

SQL Server Data Tools   15.1.61707.200
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript   2.3.4.0
TypeScript tools for Visual Studio

Visual C++ for Cross Platform Mobile Development (Android)   15.0.26724.01
Visual C++ for Cross Platform Mobile Development (Android)

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

Visual Studio tools for CMake   1.0
Visual Studio tools for CMake

Xamarin   4.6.0.295 (306f76a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   7.4.0.19 (0cd0214)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   10.12.0.14 (bf350ba)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.



### Exception Log
EFCore.App[509:147301] System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_void__this___int_int_object_object_object_object_byte_int_int_double_double_double_object_double (object,intptr,intptr,intptr)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.

  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_thread_interruption_checkpoint ()
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:661 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.Excepti
onDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow (System.Reflection.TargetInvocationException exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Utilities.cs:174 
  at System.Linq.Expressions.Interpreter.NewInstruction.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00026] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/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/10.12.
0.20/src/mono/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 <3d531496fdc44f9da4b499fb8ef64a66>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry+OriginalValues..ctor (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0000c] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.EnsureOriginalValues () [0x0000d] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntrySubscriber.SnapshotAndSubscribe (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0000f] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.Internal
EntityEntry entry) [0x00094] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState oldState, Microsoft.EntityFrameworkCore.EntityState newState, System.Boolean acceptChanges) [0x00141] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState entityState, System.Boolean acceptChanges) [0x00026] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode node) [0x00034] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode node, System.Func`2[T,TResult] handleNode) [0x00000] in <2645c1
c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode node, System.Func`2[T,TResult] handleNode) [0x0007a] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry rootEntry, Microsoft.EntityFrameworkCore.EntityState entityState) [0x00019] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.DbContext.SetEntityState (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry, Microsoft.EntityFrameworkCore.EntityState entityState) [0x00025] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.DbContext.SetEntityState[TEntity] (TEntity entity, Microsoft.EntityFrameworkCore.EntityState entityState) [0x0000f] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Micros
oft.EntityFrameworkCore.DbContext.Add[TEntity] (TEntity entity) [0x0000c] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[TEntity].Add (TEntity entity) [0x00000] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at EFCore.App.ViewController.AddQuotationBtn_TouchUpInside (UIKit.UIButton sender) [0x00044] in d:\Users\robert kite\documents\visual studio 2017\Projects\EFCore.App\EFCore.App\ViewController.cs:33 
2017-09-01 19:23:55.189 EFCore.App[509:147301] Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_void__this___int_int_object_object_object_object_byte_int_int_double_double_double_object_double (object,intptr,intptr,intptr)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.
Unhandled Exception:

System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_void__this___int_int_object_object_object_object_byte_int_int_double_double_double_object_double (object,intptr,intptr,intptr)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.


2017-09-01 19:24:03.679 EFCore.App[509:147301] 
Unhandled Exception:
System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_void__this___int_int_object_object_object_object_byte_int_int_double_double_double_object_double (object,intptr,intptr,intptr)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.

  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_thread_interruption_checkpoint ()
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:661 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.Exc
eptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow (System.Reflection.TargetInvocationException exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Utilities.cs:174 
  at System.Linq.Expressions.Interpreter.NewInstruction.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00026] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/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.fra
mework/Versions/10.12.0.20/src/mono/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 <3d531496fdc44f9da4b499fb8ef64a66>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry+OriginalValues..ctor (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0000c] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.EnsureOriginalValues () [0x0000d] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntrySubscriber.SnapshotAndSubscribe (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0000f] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking (Microsoft.EntityFrameworkCore.ChangeTrac
king.Internal.InternalEntityEntry entry) [0x00094] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState oldState, Microsoft.EntityFrameworkCore.EntityState newState, System.Boolean acceptChanges) [0x00141] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState entityState, System.Boolean acceptChanges) [0x00026] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode node) [0x00034] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode node, System.Func`2[T,TResult] handleNode
) [0x00000] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode node, System.Func`2[T,TResult] handleNode) [0x0007a] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry rootEntry, Microsoft.EntityFrameworkCore.EntityState entityState) [0x00019] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.DbContext.SetEntityState (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry, Microsoft.EntityFrameworkCore.EntityState entityState) [0x00025] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.DbContext.SetEntityState[TEntity] (TEntity entity, Microsoft.EntityFrameworkCore.EntityState entityState) [0x0000f] in <2645c1c7345546f5b968e91de8
1e2b12>:0 
  at Microsoft.EntityFrameworkCore.DbContext.Add[TEntity] (TEntity entity) [0x0000c] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[TEntity].Add (TEntity entity) [0x00000] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at EFCore.App.ViewController.AddQuotationBtn_TouchUpInside (UIKit.UIButton sender) [0x00086] in d:\Users\robert kite\documents\visual studio 2017\Projects\EFCore.App\EFCore.App\ViewController.cs:41 
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/4991/80b8487d/source/xamarin-macios/src/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/4991/80b8487d/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at EFCore
.App.Application.Main (System.String[] args) [0x00001] in d:\Users\robert kite\documents\visual studio 2017\Projects\EFCore.App\EFCore.App\Main.cs:9 
2017-09-01 19:24:03.693 EFCore.App[509:147301] Unhandled managed exception:
Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_void__this___int_int_object_object_object_object_byte_int_int_double_double_double_object_double (object,intptr,intptr,intptr)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.
 (System.ExecutionEngineException)
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_thread_interruption_checkpoint ()
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:661 
--- End of stack trace from previous location where exception was thrown ---
  at System.Run
time.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow (System.Reflection.TargetInvocationException exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/Utilities.cs:174 
  at System.Linq.Expressions.Interpreter.NewInstruction.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00026] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.12.0.20/src/mono/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/10.12.0.20/src/mono/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 <3d531496fdc44f9da4b499fb8ef64a66>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry+OriginalValues..ctor (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0000c] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.EnsureOriginalValues () [0x0000d] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntrySubscriber.SnapshotAndSubscribe (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) [0x0000f] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking (Microsoft.EntityFrameworkCore.Ch
angeTracking.Internal.InternalEntityEntry entry) [0x00094] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState oldState, Microsoft.EntityFrameworkCore.EntityState newState, System.Boolean acceptChanges) [0x00141] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState (Microsoft.EntityFrameworkCore.EntityState entityState, System.Boolean acceptChanges) [0x00026] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode node) [0x00034] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode node, System.Func`2[T,TResult] ha
ndleNode) [0x00000] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntryGraphNode node, System.Func`2[T,TResult] handleNode) [0x0007a] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry rootEntry, Microsoft.EntityFrameworkCore.EntityState entityState) [0x00019] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.DbContext.SetEntityState (Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry, Microsoft.EntityFrameworkCore.EntityState entityState) [0x00025] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.DbContext.SetEntityState[TEntity] (TEntity entity, Microsoft.EntityFrameworkCore.EntityState entityState) [0x0000f] in <2645c1c7345546f5b9
68e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.DbContext.Add[TEntity] (TEntity entity) [0x0000c] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[TEntity].Add (TEntity entity) [0x00000] in <2645c1c7345546f5b968e91de81e2b12>:0 
  at EFCore.App.ViewController.AddQuotationBtn_TouchUpInside (UIKit.UIButton sender) [0x00086] in d:\Users\robert kite\documents\visual studio 2017\Projects\EFCore.App\EFCore.App\ViewController.cs:41 
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/4991/80b8487d/source/xamarin-macios/src/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/4991/80b8487d/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  a
t EFCore.App.Application.Main (System.String[] args) [0x00001] in d:\Users\robert kite\documents\visual studio 2017\Projects\EFCore.App\EFCore.App\Main.cs:9 
2017-09-01 19:24:03.694 EFCore.App[509:147301] critical: Stacktrace:
Comment 1 Vincent Dondain [MSFT] 2017-09-04 03:03:33 UTC
Hi,

I could successfully reproduce this issue using the GitHub project linked in the description, on device, with XI 10.12.3.3 (d15-3) and 10.10.0.36 (d15-2).

Here's the full build output I got: https://gist.github.com/VincentDondain/12c2fc63fe2a2849cb3d56499fd17f76

As well as my versions information: https://gist.github.com/VincentDondain/9f2c2188e0b266ecce4ace38e6ea94a1
Comment 2 Zoltan Varga 2017-09-04 03:31:35 UTC
A minimal testcase:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                public class AClass<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> {
                        public static void doit (T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17) {
                                Console.WriteLine (t10);
                                Console.WriteLine (t17);
                        }
                }

                public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
                {
                        var t = typeof (AClass<,,,,,,,,,,,,,,,,>).MakeGenericType (new Type [] { typeof (string), typeof (string), typeof (string),

                                          typeof (string), typeof (string), typeof (string),typeof (string), typeof (string), typeof (string),typeof (string), typeof (string), typeof (string), typeof (string),

                                          typeof (string), typeof (string), typeof (string), typeof (string) });
                        object[] args = new object [17];
                        for (int i = 0; i < 17; ++i)
                                args [i] = "A" + i;
                        t.GetMethod ("doit").Invoke (null, args);
                }
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Comment 3 Rob Kite 2017-09-04 08:28:50 UTC
Is there a suitable workaround for my specific issue? Can I make some simple changes in the model?

Is the issue a direct result of the number of properties in the class, would reducing it and adding another class resolve my issue?
Comment 4 Rob Kite 2017-09-05 13:21:12 UTC
I've been able to workaround this for now by splitting up properties in my model into other classes. While this works it's not ideal as I now have additional tables in the database and additional concerns / performance impacts from joining the data between these tables.
Comment 5 Zoltan Varga 2017-09-19 20:53:19 UTC
*** Bug 59401 has been marked as a duplicate of this bug. ***
Comment 6 Zoltan Varga 2017-09-20 09:07:56 UTC
Work in progress:
https://github.com/mono/mono/pull/5612
Comment 7 Zoltan Varga 2017-09-24 08:44:46 UTC
*** Bug 58424 has been marked as a duplicate of this bug. ***
Comment 8 Zoltan Varga 2017-09-27 01:31:38 UTC
This should be fixed by:
https://github.com/mono/mono/pull/5612
but only for 64 bit arm, 32 bit arm still has the problem.
Comment 9 Rafael Romero 2017-10-18 00:43:12 UTC
Zoltan Varga How can I workaround the problem?  In a 32 bit Ipad? What would you recomend? I am know commited to entityframework in my ios app. I really need a workaround.
Comment 10 Zoltan Varga 2017-10-18 12:28:35 UTC
There is no known workaround right now for user code, the entityframework code needs to be changed.
Comment 11 Diego Vega 2017-10-18 13:04:11 UTC
FWIW, we haven’t found a reasonable change we can apply on the Entity Framework Core Core to workaround this limitation. It seems depending on the data type size, even using a threshold of 2 generic arguments can hit this. See https://github.com/aspnet/EntityFrameworkCore/issues/9249#issuecomment-332686413 for more information.
Comment 12 Zoltan Varga 2017-10-21 18:22:38 UTC
arm32 changes:

https://github.com/mono/mono/pull/5840

Note You need to log in before you can comment on or make changes to this bug.