Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xamarin: iOS NotImplementedException during query #7158

Closed
rowanmiller opened this issue Nov 29, 2016 · 18 comments
Closed

Xamarin: iOS NotImplementedException during query #7158

rowanmiller opened this issue Nov 29, 2016 · 18 comments

Comments

@rowanmiller
Copy link
Contributor

rowanmiller commented Nov 29, 2016

Reported by @econner20 - see #4269 (comment)

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.
@econner20
Copy link

@rowanmiller - any way to determine if this is something that is scheduled to be addressed in the near future or that will take a while to get to?

@rowanmiller
Copy link
Contributor Author

We don't have a schedule for this yet. We need to work with the Xamarin team to work out the best course of action.

@rowanmiller rowanmiller added this to the 1.2.0 milestone Dec 7, 2016
@rowanmiller rowanmiller self-assigned this Dec 7, 2016
@cytenic
Copy link

cytenic commented Dec 14, 2016

Perhaps this is related: https://bugzilla.xamarin.com/show_bug.cgi?id=32180#c3
Comment 3 mentions a workaround.

@ArtemKalachev
Copy link

ArtemKalachev commented Jan 22, 2017

Hello @rowanmiller

Faced the same issue on iOS platform. Do you have any resolution here or at least plan when it can be fixed?

Thanks,
Artem.

@rowanmiller
Copy link
Contributor Author

This fix will be included in a future version of Mono... there aren't any specific dates around when the fix will ship yet.

@jeffjzf
Copy link

jeffjzf commented Feb 28, 2017

Hi @rowanmiller
I am still facing this issue on the iOS platform.
Has the latest version of Mono having the fix been released yet?
Thanks,
Jeff

@rowanmiller rowanmiller assigned divega and unassigned rowanmiller Mar 10, 2017
@eoincgreenfinch
Copy link

eoincgreenfinch commented Mar 28, 2017

@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 👍

@ajcvickers ajcvickers modified the milestones: 2.0.0-preview1, 2.0.0 Apr 19, 2017
@dominicboutin
Copy link

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" />

@divega
Copy link
Contributor

divega commented May 2, 2017

Thanks @dominicboutin. That is consistent with what we have heard from the Xamarin team. I am glad to hear that you were able to test the fix. Do you know which exact version of Xamarin iOS you are using?

@dominicboutin
Copy link

@divega Xamarin.IOS 10.10.0.19

@abdu292
Copy link

abdu292 commented May 3, 2017

Thanks for the info @dominicboutin. I've yet to test this. Are you using a Mac? I'm not sure how to update to the latest mono. I don't see an update on my Visual Studio 2017 yet.
Anyone any idea?

@divega
Copy link
Contributor

divega commented May 3, 2017

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

@divega divega removed this from the 2.0.0 milestone May 3, 2017
@abdu292
Copy link

abdu292 commented May 4, 2017

Thank you @divega. I'll try that out. On vacation right now but I'll post an update as soon as I have access to my computer.

AndreKraemer added a commit to AndreKraemer/XamarinLocalDataAccessDemo that referenced this issue May 5, 2017
Currently this works for Android only and not for iOS.

See dotnet/efcore#7158 for details
@divega
Copy link
Contributor

divega commented May 5, 2017

We are closing this issue as we believe the root cause has been removed in newer versions of Xamarin iOS. That said, support for Xamarin is still considered a work in progress. Please refer to the call for help at #4269 (comment), and create new issues for any problems you find.

@cwrea
Copy link

cwrea commented May 17, 2017

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>

@Kilowhisky
Copy link

Kilowhisky commented Feb 12, 2018

@cwrea any idea what these other types are? I'm experiencing this and the file didn't seem to stop it. How do i determine which types are throwing the errors.

Message: System.TypeInitializationException: The type initializer for 'Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions' threw an exception. ---> System.InvalidOperationException: Sequence contains no matching elementXamarin Exception Stack:
  at System.Linq.Enumerable.Single[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) <0x1033ac6d0 + 0x001cc> in <98d8ae0ba2c1456c96653359c4b1be27#40ebf054405c05b7662e2bda4a6f5577>:0 
  at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.GetMethod (System.String name, System.Int32 parameterCount, System.Func`2[T,TResult] predicate) <0x103da5d58 + 0x000cf> in <5c7c882dab06409d85c27548a5ccf9d3#40ebf054405c05b7662e2bda4a6f5577>:0 
  at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions..cctor () <0x103da5e4c + 0x00037> in <5c7c882dab06409d85c27548a5ccf9d3#40ebf054405c05b7662e2bda4a6f5577>:0 
   --- End of inner exception stack trace ---
  at HELink.Services.DataContext.GetSh

@cwrea
Copy link

cwrea commented Feb 12, 2018

@Kilowhisky Looking at your exception stack trace, the exception indirectly originates in Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions..cctor () which is the class constructor for the class. A class constructor is where the static fields of a class get initialized, and if there is no explicit static constructor, the compiler creates one.

Next, look at the source for that class here. Search for the word "static" and you will see all of the different static fields declared, with their initialization code inline. Notice that many of those call GetMethod().

I presume that you need to tell the linker about additional types referenced by those GetMethod() calls, but you might need to attach the debugger to see which particular one is causing the exception you are seeing.

@bcwalnja
Copy link

I know this thread is pretty old, but I'm trying to implement this code into my Xamarin.Forms iOS project in order to solve the issues with the deprecated WebKitUI references. I'm finding that the linker is stripping out 'unused' code that then throws 'Unable to locate assembly' errors, which seemed to be solved by adding in --linkskip arguments into the -mtouch. With about 25 total arguments, I'd really like to incorporate this xml solution to cleaning it up, but I'm not sure about the execution. I tried following the advice of this SO post and adding an -mtouch argument that says

--xml=linkskip.xml

In this case, the code wouldn't compile: it yielded the error:

Could not process XML description: Failed to resolve assembly: 'Microsoft.Data.Sqlite.Core, Version...'

So instead I tried changing the -mtouch argument to say

--linkskip=linkskip.xml

In this case, my code compiles but doesn't seem to execute the linkskip arguments; it continues to throw 'assembly not found'. What should I do here?

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests