-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
iOS: Attempting to JIT compile method '(wrapper dynamic-method) string object:lambda_method1 (System.Runtime.CompilerServices.Closure)' while running in aot-only mode. #47112
Comments
Tagging subscribers to this area: @cston Issue DetailsDescriptionThe 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 27 Repro: git clone https://github.com/rolfbjarne/xamarin-macios
cd xamarin-macios
git checkout dotnet-attempting-to-jit-compile-method-lamba_method1
./configure --enable-dotnet --enable-xamarin
make reset
make all -j8
make install -j8
make mysingleview -C tests/dotnet Configuration.NET 6.0.100-alpha.1.21060.3 Binlog: Regression?No (new feature)
|
I suspect |
@MaximLipnin See if you can reproduce and give Egor's suggestion a try after. |
I faced a lot of library test failures with similar error in in #50510. I have no any ios device at hand so I'll try re-enabling System.Linq.Expresions test suite in the PR and see any related CI failures. |
@MaximLipnin try testing against the simulator with aot enabled. You should be able to take Rolf's example and alter the functional test to repro. |
It's reproducible against the simulator when executing
@EgorBo What would be the right way to apply your suggestion? When trying to set
The |
@ViktorHofer Not quite sure who to ask, but would you happen to know the answer to Maxim's question? |
@MaximLipnin I guess nobody tested "true" for that condition and it doesn't expose the same public APIs when it's set.
that should not be difficult to fix |
Right, we had that option enabled on some configurations (I believe uap) which don't exist anymore. Nobody noticed that the API surface diverged when using the interpreter mode. |
This is an attempt to address #47112 based on Egor's suggestion. The changes: - set IsInterpreting MSBuild property to 'true' in case of iOS; - made System.Linq.Expressions.ExpressionCreator class internal static in order not to introduce new public type; otherwise it throws Type 'System.Linq.Expressions.ExpressionCreator<TDelegate>' does not exist in the reference but it does exist in the implementation. -updated the iOS simulator functional test for AOT to verify the fix - added PlatformDetection.IsLinqExpressionsBuiltWithIsInterpretingOnly which checks whether the System.Linq.Expressions is built with IsInterpreting property set to true. To do so, it uses reflection to verify the Expression.Accept method doesn't exist. - disabled some failing library tests using ActiveIssue + PlatformDetection. - updated the invariant functional test for the iOS simulator (b/c of Allow restricting cultures creation with any arbitrary names in Globalization Invariant Mode #54247) Co-authored-by: Stephen Toub <[email protected]>
Description
The following code throws an exception at runtime when running on an iOS device:
Exception:
Repro:
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/dotnet
Complete output
Configuration
.NET 6.0.100-alpha.1.21060.3
Binlog:
MySingleView.binlog.zip
Regression?
No (new feature)
The text was updated successfully, but these errors were encountered: