question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Will not run on iOS hardware devices

See original GitHub issue

Describe the bug

Build, deploy, and run to an iOS hardware device (ex: iPhone 13) results in the following exception description:

Attempting to JIT compile method '(wrapper delegate-invoke) long <Module>:invoke_callvirt_long_ [...] ' while running in aot-only mode.

EXCEPTION

Exception has been thrown by the target of an invocation.

System.Reflection.TargetInvocationException
   at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo )
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.<>c__DisplayClass5_0.<PartiallyEvaluate>b__0(Expression expr, Func`2 recurse) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 154
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.Visit(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression )
   at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor )
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression )
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.<Visit>b__5_0(Expression e) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.<>c__DisplayClass5_0.<PartiallyEvaluate>b__0(Expression expr, Func`2 recurse) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 159
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.Visit(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at System.Linq.Expressions.ExpressionVisitor.VisitLambda[Func`2](Expression`1 )
   at System.Linq.Expressions.Expression`1[[System.Func`2[[eContainment4.Models.ContainmentVehicle, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Boolean, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Accept(ExpressionVisitor )
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression )
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.<Visit>b__5_0(Expression e) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.<>c__DisplayClass5_0.<PartiallyEvaluate>b__0(Expression expr, Func`2 recurse) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 159
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.Visit(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression )
   at System.Linq.Expressions.UnaryExpression.Accept(ExpressionVisitor )
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression )
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.<Visit>b__5_0(Expression e) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.<>c__DisplayClass5_0.<PartiallyEvaluate>b__0(Expression expr, Func`2 recurse) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 159
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.Visit(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor , IArgumentProvider )
   at System.Linq.Expressions.ExpressionVisitor.VisitArguments(IArgumentProvider )
   at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression )
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor )
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression )
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.<Visit>b__5_0(Expression e) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.<>c__DisplayClass5_0.<PartiallyEvaluate>b__0(Expression expr, Func`2 recurse) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 159
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.Visit(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.VisitAll(Expression expression, Func`3 visitor) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 57
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.PartiallyEvaluate(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 149
   at Microsoft.Datasync.Client.Query.Linq.QueryTranslator`1[[eContainment4.Models.ContainmentVehicle, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Translate()
   at Microsoft.Datasync.Client.Query.TableQuery`1[[eContainment4.Models.ContainmentVehicle, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ToODataString(Boolean includeParameters)
   at Microsoft.Datasync.Client.Table.OfflineTable`1[[eContainment4.Models.ContainmentVehicle, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].PullItemsAsync[ContainmentVehicle](ITableQuery`1 query, PullOptions options, CancellationToken cancellationToken)
   at TMNA.Datasync.Client.Extensions.OfflineTableExtensions.<TryPullItemsAsync>d__0`1[[eContainment4.Models.ContainmentVehicle, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()

INNER EXCEPTION:

Attempting to JIT compile method ‘(wrapper delegate-invoke) long <Module>:invoke_callvirt_long_Containment (eContainment4.Models.Containment)’ while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.

System.ExecutionEngineException
   at System.Linq.Expressions.Interpreter.FuncCallInstruction`2[[eContainment4.Models.Containment, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Int64, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Run(InterpretedFrame )
   at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame )
   at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[] )
   at System.Dynamic.Utils.DelegateHelpers.FuncThunk[Int64](Func`2 handler)
   at System.Reflection.MethodInvoker.InterpretedInvoke(Object , Span`1 , BindingFlags )]

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ExecutionEngineException: Attempting to JIT compile method '(wrapper delegate-invoke) long <Module>:invoke_callvirt_long_Containment (eContainment4.Models.Containment)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.

   at System.Linq.Expressions.Interpreter.FuncCallInstruction`2[[eContainment4.Models.Containment, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Int64, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Run(InterpretedFrame )
   at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame )
   at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[] )
   at System.Dynamic.Utils.DelegateHelpers.FuncThunk[Int64](Func`2 handler)
   at System.Reflection.MethodInvoker.InterpretedInvoke(Object , Span`1 , BindingFlags )
   --- End of inner exception stack trace ---
   at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo )
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.<>c__DisplayClass5_0.<PartiallyEvaluate>b__0(Expression expr, Func`2 recurse) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 154
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.Visit(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at System.Linq.Expressions.ExpressionVisitor.VisitBinary(BinaryExpression )
   at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor )
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression )
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.<Visit>b__5_0(Expression e) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.<>c__DisplayClass5_0.<PartiallyEvaluate>b__0(Expression expr, Func`2 recurse) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 159
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.Visit(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at System.Linq.Expressions.ExpressionVisitor.VisitLambda[Func`2](Expression`1 )
   at System.Linq.Expressions.Expression`1[[System.Func`2[[eContainment4.Models.ContainmentVehicle, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Boolean, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Accept(ExpressionVisitor )
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression )
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.<Visit>b__5_0(Expression e) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.<>c__DisplayClass5_0.<PartiallyEvaluate>b__0(Expression expr, Func`2 recurse) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 159
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.Visit(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression )
   at System.Linq.Expressions.UnaryExpression.Accept(ExpressionVisitor )
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression )
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.<Visit>b__5_0(Expression e) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.<>c__DisplayClass5_0.<PartiallyEvaluate>b__0(Expression expr, Func`2 recurse) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 159
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.Visit(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor , IArgumentProvider )
   at System.Linq.Expressions.ExpressionVisitor.VisitArguments(IArgumentProvider )
   at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression )
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor )
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression )
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.<Visit>b__5_0(Expression e) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.<>c__DisplayClass5_0.<PartiallyEvaluate>b__0(Expression expr, Func`2 recurse) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 159
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.Visit(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 85
   at Microsoft.Datasync.Client.Query.Linq.VisitorHelper.VisitAll(Expression expression, Func`3 visitor) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/VisitorHelper.cs:line 57
   at Microsoft.Datasync.Client.Query.Linq.ExpressionExtensions.PartiallyEvaluate(Expression expression) in /Users/ben/Development/Toyota/ECS_Client.Uno.WinUI/Microsoft.Datasync/sdk/dotnet/src/Microsoft.Datasync.Client/Query/Linq/ExpressionExtensions.cs:line 149
   at Microsoft.Datasync.Client.Query.Linq.QueryTranslator`1[[eContainment4.Models.ContainmentVehicle, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Translate()
   at Microsoft.Datasync.Client.Query.TableQuery`1[[eContainment4.Models.ContainmentVehicle, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ToODataString(Boolean includeParameters)
   at Microsoft.Datasync.Client.Table.OfflineTable`1[[eContainment4.Models.ContainmentVehicle, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].PullItemsAsync[ContainmentVehicle](ITableQuery`1 query, PullOptions options, CancellationToken cancellationToken)
   at TMNA.Datasync.Client.Extensions.OfflineTableExtensions.<TryPullItemsAsync>d__0`1[[eContainment4.Models.ContainmentVehicle, eContainment4.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()

Is this because a number of LINQ extensions methods don’t work with iOS AOT?

To Reproduce

Steps to reproduce the behavior:

  1. Build and run app using IOfflineTable.PullItemsAsync<U>(ITableQuery<U> query, PullOptions options, CancellationToken cancellationToken = default)
  2. Deploy app to iOS device
  3. Call IOfflineTable.PullItemsAsync<U>
  4. See error

Expected behavior

Library should support iOS AOT as older versions, circa November 2020, did. Broken link to older version of library: https://github.com/Azure/azure-mobile-apps-net-client

What platforms?

  • Client : iOS (works great on Android and WinUI)
    • .NET Runtime Environment : net7.0-ios
    • Library versions: 5.1.0 (commit 8c4ce4a)
    • What platform versions are you running on? iOS 16.4
    • Does it happen in an emulator / simulator, or only on a real device? Only on real device

Screenshots

n/a

Additional context

Message me if you want a real demo project. It will take a lot work but I believe I can get you one (the real issue is user access).

Issue Analytics

  • State:closed
  • Created 7 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
adrianhallcommented, Feb 16, 2023
0reactions
github-actions[bot]commented, Mar 25, 2023

We have noticed this issue has not been updated within 30 days. If there is no action on this issue in the next 14 days, we will automatically close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't Run code on the real device
I currently developed my app using Objective-C. Previously, I used Xcode 8.2.1 and I can directly load the code into my devices without...
Read more >
Not able to run my app on my physical iPhone device?
I was building an app it is working in simulator and than I tried to run it on my physical iPhone device it...
Read more >
Xcode 5.1.1 cannot run on device with iOS 8.0 version
I am using Xcode 5.1.1 as I require an app which supports iOS 6.1 and Above with base SDK iOS 7.1. I tried...
Read more >
Running On Device
This document will guide you through the necessary steps to run your React Native app on a device and to get it ready...
Read more >
Running Your iOS Application on an iOS Device
You can run your application on an iOS device only after you have successfully completed the following steps: Configure your development environment for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found