efcore: Xamarin: iOS NotImplementedException during query

Reported by @econner20 - see https://github.com/aspnet/EntityFramework/issues/4269#issuecomment-263595495

I am having an issue with iOS. I used the example models and context from the example @polkduran provided and was successful in getting EF to work with Android, UWP and a Winforms target. However when I run the same Xamarin project/NETStandard assembly the iOS target is throwing the following exception: Unhandled Exception: System.NotImplementedException: Interpreter of ref types when trying to execute the following:

Person owner = db.People.AsNoTracking().FirstOrDefault();
Unhandled Exception:

System.NotImplementedException: Interpreter of ref types

2016-11-29 13:31:40.313 MobileiOS[27168:602343] 
Unhandled Exception:
System.NotImplementedException: Interpreter of ref types
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileMethodCallExpression (System.Linq.Expressions.Expression expr) [0x00089] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1283 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileNoLabelPush (System.Linq.Expressions.Expression expr) [0x001ba] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1642 
  at Microsoft.Scripting.Interpreter.LightCompiler.Compile (System.Linq.Expressions.Expression expr) [0x00008] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Fra
meworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1729 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileConvertUnaryExpression (System.Linq.Expressions.Expression expr) [0x00086] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:684 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileNoLabelPush (System.Linq.Expressions.Expression expr) [0x001ff] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1646 
  at Microsoft.Scripting.Interpreter.LightCompiler.Compile (System.Linq.Expressions.Expression expr) [0x00008] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.i
OS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1729 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileTryExpression (System.Linq.Expressions.Expression expr) [0x0005a] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1159 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileNoLabelPush (System.Linq.Expressions.Expression expr) [0x004a2] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1697 
  at Microsoft.Scripting.Interpreter.LightCompiler.Compile (System.Linq.Expressions.Expression expr) [0x00008] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git
/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1729 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileMemberAssignment (System.Linq.Expressions.BinaryExpression node, System.Boolean asVoid) [0x000f5] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:494 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileAssignBinaryExpression (System.Linq.Expressions.Expression expr, System.Boolean asVoid) [0x0004e] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:528 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileAsVoid (System.Linq.Expressions.Expression expr) [0x00059] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/
Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1602 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileBlockStart (System.Linq.Expressions.BlockExpression node) [0x000b0] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:405 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileBlockExpression (System.Linq.Expressions.Expression expr, System.Boolean asVoid) [0x00007] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:376 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileNoLabelPush (System.Linq.Expressions.Expression expr) [0x003d0] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-b
uild/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1683 
  at Microsoft.Scripting.Interpreter.LightCompiler.Compile (System.Linq.Expressions.Expression expr) [0x00008] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1729 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileTop (System.Linq.Expressions.LambdaExpression node) [0x00055] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:221 
  at Microsoft.Scripting.Generation.CompilerHelpers.LightCompile (System.Linq.Expressions.LambdaExpression lambda) [0x00000] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xam
arin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/CompilerHelpers.cs:619 
  at System.Linq.Expressions.Compiler.LambdaCompiler.Compile (System.Linq.Expressions.LambdaExpression lambda, System.Runtime.CompilerServices.DebugInfoGenerator debugInfoGenerator) [0x00000] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.Core/System.Linq.Expressions.Interpret/LambdaCompiler.cs:41 
  at System.Linq.Expressions.Expression`1[TDelegate].Compile () [0x00000] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs:195 
  at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.RelationalEntityQueryableExpressionVisitor.CreateShaper (System.Type elementType, Microsoft.EntityFrameworkCore.Metadata.IEntityType entityType, Micro
soft.EntityFrameworkCore.Query.Expressions.SelectExpression selectExpression) [0x00047] in <f97b8874924247a39fca91e98b024cf6>:0 
  at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.RelationalEntityQueryableExpressionVisitor.VisitEntityQueryable (System.Type elementType) [0x001cb] in <f97b8874924247a39fca91e98b024cf6>:0 
  at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.EntityQueryableExpressionVisitor.VisitConstant (System.Linq.Expressions.ConstantExpression constantExpression) [0x0003c] in <b004cff6238d4ed08011af53475172bf>:0 
  at System.Linq.Expressions.ConstantExpression.Accept (System.Linq.Expressions.ExpressionVisitor visitor) [0x00000] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ConstantExpression.cs:83 
  at System.Linq.Expressions.ExpressionVisitor.Visit (System.Linq.Expressions.Expression node) [0x00006] in /Users/builder/data/lanes/3969/
44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System.Core/Microsoft/Scripting/Ast/ExpressionVisitor.cs:57 
  at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.ExpressionVisitorBase.Visit (System.Linq.Expressions.Expression node) [0x0000d] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.ReplaceClauseReferences (System.Linq.Expressions.Expression expression, Remotion.Linq.Clauses.IQuerySource querySource, System.Boolean inProjection) [0x00019] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CompileMainFromClauseExpression (Remotion.Linq.Clauses.MainFromClause mainFromClause, Remotion.Linq.QueryModel queryModel) [0x0001f] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.CompileMainFromClauseExpression (Remotion.Linq.Clauses.MainFromClause mainFrom
Clause, Remotion.Linq.QueryModel queryModel) [0x00018] in <f97b8874924247a39fca91e98b024cf6>:0 
  at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.VisitMainFromClause (Remotion.Linq.Clauses.MainFromClause fromClause, Remotion.Linq.QueryModel queryModel) [0x00018] in <b004cff6238d4ed08011af53475172bf>:0 
  at Remotion.Linq.Clauses.MainFromClause.Accept (Remotion.Linq.IQueryModelVisitor visitor, Remotion.Linq.QueryModel queryModel) [0x00018] in <0a52ab02a5054a9e94c0cd3993f4d33a>:0 
  at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel (Remotion.Linq.QueryModel queryModel) [0x00012] in <0a52ab02a5054a9e94c0cd3993f4d33a>:0 
  at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.VisitQueryModel (Remotion.Linq.QueryModel queryModel) [0x0000c] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.VisitQueryModel (Remotion.Linq.QueryModel queryModel) [0x00036] in <f97b8874924247a39fca91e98b024cf6>:0 
  at Microsoft.EntityFrameworkCore.
Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult] (Remotion.Linq.QueryModel queryModel) [0x0008f] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult] (Remotion.Linq.QueryModel queryModel) [0x0001c] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult] (System.Linq.Expressions.Expression query, Remotion.Linq.Parsing.Structure.INodeTypeProvider nodeTypeProvider, Microsoft.EntityFrameworkCore.Storage.IDatabase database, Microsoft.Extensions.Logging.ILogger logger, System.Type contextType) [0x0005a] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler+<>c__DisplayClass19_0`1[TResult].<CompileQuery>b__0 () [0x00011] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc] (System.Object cacheKey, System.Func`1[TResult] compiler) [0x0001e] i
n <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult] (System.Object cacheKey, System.Func`1[TResult] compiler) [0x00000] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQuery[TResult] (System.Linq.Expressions.Expression query) [0x00049] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult] (System.Linq.Expressions.Expression query) [0x00022] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult] (System.Linq.Expressions.Expression expression) [0x00000] in <b004cff6238d4ed08011af53475172bf>:0 
  at System.Linq.Queryable.FirstOrDefault[TSource] (System.Linq.IQueryable`1[T] source) [0x00011] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/c
lass/referencesource/System.Core/System/Linq/IQueryable.cs:796 
  at Mobile.App..ctor () [0x000ad] in E:\Development\Visual Studio Projects\Project1\Mobile\App.xaml.cs:54 
  at Mobile.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00007] in E:\Development\Visual Studio Projects\Project1\Mobile.iOS\AppDelegate.cs:26 
  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/3969/44931ae8/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/3969/44931ae8/source/xamarin-macio
s/src/UIKit/UIApplication.cs:63 
  at Mobile.iOS.Application.Main (System.String[] args) [0x00001] in E:\Development\Visual Studio Projects\Project1\Mobile.iOS\Main.cs:17 
2016-11-29 13:31:40.319 MobileiOS[27168:602343] Unhandled managed exception:
Interpreter of ref types (System.NotImplementedException)
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileMethodCallExpression (System.Linq.Expressions.Expression expr) [0x00089] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1283 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileNoLabelPush (System.Linq.Expressions.Expression expr) [0x001ba] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/R
untime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1642 
  at Microsoft.Scripting.Interpreter.LightCompiler.Compile (System.Linq.Expressions.Expression expr) [0x00008] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1729 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileConvertUnaryExpression (System.Linq.Expressions.Expression expr) [0x00086] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:684 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileNoLabelPush (System.Linq.Expressions.Expression expr) [0x001ff] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.
Dynamic/Interpreter/LightCompiler.cs:1646 
  at Microsoft.Scripting.Interpreter.LightCompiler.Compile (System.Linq.Expressions.Expression expr) [0x00008] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1729 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileTryExpression (System.Linq.Expressions.Expression expr) [0x0005a] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1159 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileNoLabelPush (System.Linq.Expressions.Expression expr) [0x004a2] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Light
Compiler.cs:1697 
  at Microsoft.Scripting.Interpreter.LightCompiler.Compile (System.Linq.Expressions.Expression expr) [0x00008] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1729 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileMemberAssignment (System.Linq.Expressions.BinaryExpression node, System.Boolean asVoid) [0x000f5] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:494 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileAssignBinaryExpression (System.Linq.Expressions.Expression expr, System.Boolean asVoid) [0x0004e] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Run
time/Microsoft.Dynamic/Interpreter/LightCompiler.cs:528 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileAsVoid (System.Linq.Expressions.Expression expr) [0x00059] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1602 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileBlockStart (System.Linq.Expressions.BlockExpression node) [0x000b0] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:405 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileBlockExpression (System.Linq.Expressions.Expression expr, System.Boolean asVoid) [0x00007] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class
/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:376 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileNoLabelPush (System.Linq.Expressions.Expression expr) [0x003d0] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1683 
  at Microsoft.Scripting.Interpreter.LightCompiler.Compile (System.Linq.Expressions.Expression expr) [0x00008] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1729 
  at Microsoft.Scripting.Interpreter.LightCompiler.CompileTop (System.Linq.Expressions.LambdaExpression node) [0x00055] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic
/Interpreter/LightCompiler.cs:221 
  at Microsoft.Scripting.Generation.CompilerHelpers.LightCompile (System.Linq.Expressions.LambdaExpression lambda) [0x00000] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/CompilerHelpers.cs:619 
  at System.Linq.Expressions.Compiler.LambdaCompiler.Compile (System.Linq.Expressions.LambdaExpression lambda, System.Runtime.CompilerServices.DebugInfoGenerator debugInfoGenerator) [0x00000] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.Core/System.Linq.Expressions.Interpret/LambdaCompiler.cs:41 
  at System.Linq.Expressions.Expression`1[TDelegate].Compile () [0x00000] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Micros
oft.Scripting.Core/Ast/LambdaExpression.cs:195 
  at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.RelationalEntityQueryableExpressionVisitor.CreateShaper (System.Type elementType, Microsoft.EntityFrameworkCore.Metadata.IEntityType entityType, Microsoft.EntityFrameworkCore.Query.Expressions.SelectExpression selectExpression) [0x00047] in <f97b8874924247a39fca91e98b024cf6>:0 
  at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.RelationalEntityQueryableExpressionVisitor.VisitEntityQueryable (System.Type elementType) [0x001cb] in <f97b8874924247a39fca91e98b024cf6>:0 
  at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.EntityQueryableExpressionVisitor.VisitConstant (System.Linq.Expressions.ConstantExpression constantExpression) [0x0003c] in <b004cff6238d4ed08011af53475172bf>:0 
  at System.Linq.Expressions.ConstantExpression.Accept (System.Linq.Expressions.ExpressionVisitor visitor) [0x00000] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xa
marin.iOS.framework/Versions/git/src/mono/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ConstantExpression.cs:83 
  at System.Linq.Expressions.ExpressionVisitor.Visit (System.Linq.Expressions.Expression node) [0x00006] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System.Core/Microsoft/Scripting/Ast/ExpressionVisitor.cs:57 
  at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.ExpressionVisitorBase.Visit (System.Linq.Expressions.Expression node) [0x0000d] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.ReplaceClauseReferences (System.Linq.Expressions.Expression expression, Remotion.Linq.Clauses.IQuerySource querySource, System.Boolean inProjection) [0x00019] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CompileMainFromClauseExpression (Remotion.Linq.Clauses.MainFrom
Clause mainFromClause, Remotion.Linq.QueryModel queryModel) [0x0001f] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.CompileMainFromClauseExpression (Remotion.Linq.Clauses.MainFromClause mainFromClause, Remotion.Linq.QueryModel queryModel) [0x00018] in <f97b8874924247a39fca91e98b024cf6>:0 
  at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.VisitMainFromClause (Remotion.Linq.Clauses.MainFromClause fromClause, Remotion.Linq.QueryModel queryModel) [0x00018] in <b004cff6238d4ed08011af53475172bf>:0 
  at Remotion.Linq.Clauses.MainFromClause.Accept (Remotion.Linq.IQueryModelVisitor visitor, Remotion.Linq.QueryModel queryModel) [0x00018] in <0a52ab02a5054a9e94c0cd3993f4d33a>:0 
  at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel (Remotion.Linq.QueryModel queryModel) [0x00012] in <0a52ab02a5054a9e94c0cd3993f4d33a>:0 
  at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.VisitQueryModel (Remotion.Linq.QueryModel queryModel) [0
x0000c] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.RelationalQueryModelVisitor.VisitQueryModel (Remotion.Linq.QueryModel queryModel) [0x00036] in <f97b8874924247a39fca91e98b024cf6>:0 
  at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult] (Remotion.Linq.QueryModel queryModel) [0x0008f] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult] (Remotion.Linq.QueryModel queryModel) [0x0001c] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult] (System.Linq.Expressions.Expression query, Remotion.Linq.Parsing.Structure.INodeTypeProvider nodeTypeProvider, Microsoft.EntityFrameworkCore.Storage.IDatabase database, Microsoft.Extensions.Logging.ILogger logger, System.Type contextType) [0x0005a] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler+<>c__Displa
yClass19_0`1[TResult].<CompileQuery>b__0 () [0x00011] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc] (System.Object cacheKey, System.Func`1[TResult] compiler) [0x0001e] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult] (System.Object cacheKey, System.Func`1[TResult] compiler) [0x00000] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQuery[TResult] (System.Linq.Expressions.Expression query) [0x00049] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult] (System.Linq.Expressions.Expression query) [0x00022] in <b004cff6238d4ed08011af53475172bf>:0 
  at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult] (System.Linq.Expressions.Expression expression) [0x00000] in <b004cff6238d4ed08011a
f53475172bf>:0 
  at System.Linq.Queryable.FirstOrDefault[TSource] (System.Linq.IQueryable`1[T] source) [0x00011] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System.Core/System/Linq/IQueryable.cs:796 
  at Mobile.App..ctor () [0x000ad] in E:\Development\Visual Studio Projects\Project1\Mobile\App.xaml.cs:54 
  at Mobile.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00007] in E:\Development\Visual Studio Projects\Project1\Mobile.iOS\AppDelegate.cs:26 
  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/39
69/44931ae8/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/3969/44931ae8/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at Mobile.iOS.Application.Main (System.String[] args) [0x00001] in E:\Development\Visual Studio Projects\Project1\Mobile.iOS\Main.cs:17 
2016-11-29 13:31:40.320 MobileiOS[27168:602343] critical: Stacktrace:

2016-11-29 13:31:40.320 MobileiOS[27168:602343] critical: 
Native stacktrace:
2016-11-29 13:31:40.486 MobileiOS[27168:602343] critical: 	0   MobileiOS         0x0000000100e56fad mono_handle_native_sigsegv + 253
2016-11-29 13:31:40.487 MobileiOS[27168:602343] critical: 	1   libsystem_platform.dylib            0x000000010c7ebbba _sigtramp + 26
2016-11-29 13:31:40.488 MobileiOS[27168:602343] critical: 	2   libsystem_pthread.dylib             0x000000010c8092c8 _pthread_keys + 9720
2016-11-29 13:31:40.489 MobileiOS[27168:602343] critical: 	3   libsystem_c.dylib                   0x000000010c45ffd7 abort + 129
2016-11-29 13:31:40.491 MobileiOS[27168:602343] critical: 	4   MobileiOS         0x0000000100fed03f xamarin_unhandled_exception_handler + 47
2016-11-29 13:31:40.492 MobileiOS[27168:602343] critical: 	5   MobileiOS         0x0000000100e5787c mono_invoke_unhandled_exception_hook + 92
2016-11-29 13:31:40.493 MobileiOS[27168:602343] critical: 	6   MobileiOS         0x0000000100e567ff mono_handle_exception_internal + 5119
2016-11-29 13:31:40.493 MobileiOS[27168:602343] critical: 	7   MobileiOS         0x0000000100e553f8 mono_handle_exception + 24
2016-11-29 13:31:40.493 MobileiOS[27168:602343] critical: 	8   MobileiOS         0x0000000100dcff6f mono_amd64_throw_exception + 143
2016-11-29 13:31:40.494 MobileiOS[27168:602343] critical: 	9   ???                                 0x0000000120ddf9e7 0x0 + 4846385639
2016-11-29 13:31:40.494 MobileiOS[27168:602343] critical: 	10  ???                                 0x00000001254bed60 0x0 + 4920700256
2016-11-29 13:31:40.495 MobileiOS[27168:602343] critical: 	11  ???                                 0x00000001254bfcec 0x0 + 4920704236
2016-11-29 13:31:40.495 MobileiOS[27168:602343] critical: 
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
The app has been terminated.
Launch failed. The app 'Mobile.iOS' could not be launched on 'iPhone 6 Plus iOS 10.1'. Error: An error occurred while executing MTouch. Please check the logs for more details.
The app has been terminated.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@rowanmiller / @divega

Hey Rowan, Diego,

Just wondering if there’s any update on this re: Roadmap/Time-to-fix. The original bug over on the the xamarin bugzilla hasn’t had any update in months. And the only mention of Xamarin on the EFCore Road map (https://github.com/aspnet/EntityFramework/wiki/Roadmap) is an acknowledgement that it doesn’t work in all scenarios.

Just wondering if you can provide the community with a formal update, or simply acknowledge that this is far enough down the priority list, that anyone trying to build xamarin apps targetting IOS should consider using something else in the short term.

Cheers for all the efforts. Aside from this one bugbear, it looks great 👍

Here’s a tip for anybody else trying to get EF Core working on the latest Xamarin.iOS bits (10.10+):

While the blocker issue (NotImplementedException during query) is gone, builds that target a physical iOS device, as opposed to the iOS simulator, will still experience runtime errors from EF Core, due to the Xamarin linker removing certain SDK types and methods that EF Core depends on but that haven’t been directly referenced. (e.g. search the EF Core repo for instances of GetRuntimeMethod.)

To fix, you need to tell the Xamarin linker not to exclude such things used by EF Core. In a sample I updated, the following did the trick to get it to run successfully on-device. I’ll note that more complex usage of EF Core is likely to require a few more types and methods added to this:

<?xml version="1.0" encoding="utf-8" ?>
<linker>
  <assembly fullname="mscorlib">
    <type fullname="System.String">
      <method name="Compare"></method>
      <method name="CompareTo"></method>
      <method name="ToUpper"></method>
      <method name="ToLower"></method>
    </type>
  </assembly>
  <assembly fullname="System.Core">
    <type fullname="System.Linq.Expressions.Expression`1"></type>
    <type fullname="System.Linq.Queryable"></type>
  </assembly>
</linker>

Hello everyone,

I just wanted to let you know, my application used to get that error but after updating Xamarin with the beta version, I can migrate, add and query data successfully. It seems like Mono 5.0 resolves the NotImplementedException issue but I didn’t test all the EF features.

Tested with: <package id="Microsoft.Data.Sqlite" version="1.1.0" targetFramework="xamarinios10" /> <package id="Microsoft.EntityFrameworkCore" version="1.1.0" targetFramework="xamarinios10" /> <package id="Microsoft.EntityFrameworkCore.Relational" version="1.1.0" targetFramework="xamarinios10" /> <package id="Microsoft.EntityFrameworkCore.Sqlite" version="1.1.0" targetFramework="xamarinios10" />

@abdu292 according to these Xamarin release notes, Xamarin iOS 10.10 should be included in Visual Studio 2017 15.2 Preview 2.