Commit 79eed70
committed
[Java.Interop.Export] Remove Action/Func use.
Context: dotnet/android#4631
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3685184&view=logs&j=b1314ebb-4483-559c-0367-730fc62c4440&t=5022c07e-db44-5ce4-1a38-092215b61c50
Context: 70fc4c0
Commit 70fc4c0 broke use of `jnimarshalmethod-gen.exe` within
xamarin-android and `Mono.Android.dll`, as it allows methods taking
more than 14 parameters to be bound, which results in
`jnimarshalmethod-gen.exe` trying to use an `Action<…>` or
`Func<…>` that takes more than 16 parameters, which isn't allowed:
EXEC : error : jnimarshalmethod-gen: Unable to process assembly '…/xamarin-android/bin/Release/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v10.0/Mono.Android.dll'
An incorrect number of type arguments were specified for the declaration of an Action type.
Parameter name: typeArgs
System.ArgumentException: An incorrect number of type arguments were specified for the declaration of an Action type.
Parameter name: typeArgs
at System.Linq.Expressions.Expression.GetActionType (System.Type[] typeArgs)
at Java.Interop.MarshalMemberBuilder.CreateMarshalToManagedExpression (System.Reflection.MethodInfo method, Java.Interop.JavaCallableAttribute callable, System.Type type)
at Java.Interop.MarshalMemberBuilder.CreateMarshalToManagedExpression (System.Reflection.MethodInfo method)
at Xamarin.Android.Tools.JniMarshalMethodGenerator.App.CreateMarshalMethodAssembly (System.String path)
at Xamarin.Android.Tools.JniMarshalMethodGenerator.App.ProcessAssemblies (System.Collections.Generic.List`1[T] assemblies)
Looks like we don't actually *need* to lookup a delegate type, as
there's an `Expression.Lambda()` overload which only requires the
lambda body and parameters. Use that instead.
Remove use of `Expression.GetActionType()` and
`Expression.GetFuncType()`, as these will fail when dealing with
methods that contain more than 14 parameters:1 parent 56955d9 commit 79eed70
1 file changed
Lines changed: 1 addition & 11 deletions
Lines changed: 1 addition & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
223 | 222 | | |
224 | 223 | | |
225 | | - | |
226 | | - | |
227 | 224 | | |
228 | 225 | | |
229 | 226 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | 227 | | |
238 | 228 | | |
239 | 229 | | |
240 | | - | |
| 230 | + | |
241 | 231 | | |
242 | 232 | | |
243 | 233 | | |
| |||
0 commit comments