Expression.Lambda(exp, parameters);
It completely works in JIT. For AOT, it works with <= 15 parameters.
for 16 parameters, exception was thrown as follow:
System.NotImplementedException: byref delegate
at System.Linq.Expressions.Interpreter.LightLambda.CreateCustomDelegate (System.Type delegateType) <0x1052b3620 + 0x00738> in <b17c8f8ec0e94e6aa946d54abe0cfd86#d5047ea47da6b88a294b7510b13ff6ef>:0
at System.Linq.Expressions.Interpreter.LightLambda.MakeDelegate (System.Type delegateType) <0x1052b3da0 + 0x0005f> in <b17c8f8ec0e94e6aa946d54abe0cfd86#d5047ea47da6b88a294b7510b13ff6ef>:0
at System.Linq.Expressions.Interpreter.LightDelegateCreator.CreateDelegate (System.Runtime.CompilerServices.IStrongBox[] closure) <0x1052ac220 + 0x0006f> in <b17c8f8ec0e94e6aa946d54abe0cfd86#d5047ea47da6b88a294b7510b13ff6ef>:0
for >= 17 parameters, exception was thrown as follow:
System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Linq.Expressions.Compiler.DelegateHelpers.MakeNewCustomDelegate (System.Type[] types) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Expressions.Compiler.DelegateHelpers.MakeNewDelegate (System.Type[] types) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Expressions.Compiler.DelegateHelpers.MakeDelegateType (System.Type[] types) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Expressions.Expression.Lambda (System.Linq.Expressions.Expression body, System.String name, System.Boolean tailCall, System.Collections.Generic.IEnumerable`1[T] parameters) [0x00000] in <00000000000000000000000000000000>:0
I know AOT should not compile any expressions in runtime, it will affect the performance as there is a fallback process. So I am not asking about the best approach, just want to figure out why exceptions were thrown when too many parameters but works with <= 15 parameters in AOT.
Aucun commentaire:
Enregistrer un commentaire