- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.2k
Closed
Description
Description
The following code throws an exception at runtime when running on an iOS device:
var foos = new string [] { "hi", "bye" };
string f = foos.AsQueryable ().First ();Exception:
System.ExecutionEngineException: Attempting to JIT compile method '(wrapper dynamic-method) string object:lambda_method1 (System.Runtime.CompilerServices.Closure)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
    at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method, Boolean throwOnBindFailure, Boolean allowClosed)
    at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method, Boolean throwOnBindFailure)
    at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method)
    at System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType, Object target)
    at System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate()
    at System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression lambda)
    at System.Linq.Expressions.Expression`1[[System.Func`1[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Compile()
    at System.Linq.EnumerableExecutor`1[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Execute()
    at System.Linq.EnumerableQuery`1[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].System.Linq.IQueryProvider.Execute[String](Expression expression)
    at System.Linq.Queryable.First[String](IQueryable`1 source)
    at MySingleView.AppDelegate.FinishedLaunching(UIApplication app, NSDictionary options) in /Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/AppDelegate.cs:line 27Repro:
git clone https://github.com/rolfbjarne/xamarin-macios
cd xamarin-macios
git checkout dotnet-attempting-to-jit-compile-method-lamba_method1
./configure --enable-dotnet
make reset
make all -j8
make install -j8
make mysingleview -C tests/dotnetConfiguration
.NET 6.0.100-alpha.1.21060.3
Binlog:
MySingleView.binlog.zip
Regression?
No (new feature)