- Home /
Unity 2017.3 Android IL2CPP ArgumentNullException
Hello, I'm using too many external libraries in my project to check what causes this error and I can't figure out where this error actually comes from. Please help. :) It works fine with Mono, but with IL2CPP this happens:
01-12 15:44:00.330: E/Unity(13561): ArgumentNullException: Value cannot be null. 01-12 15:44:00.330: E/Unity(13561): Parameter name: method 01-12 15:44:00.330: E/Unity(13561): at System.Dynamic.Utils.ContractUtils.RequiresNotNull (System.Object value, System.String paramName) [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.330: E/Unity(13561): at System.Linq.Expressions.Expression.Call (System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0) [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.330: E/Unity(13561): at System.Runtime.CompilerServices.CallSite`1[T].CreateCustomNoMatchDelegate (System.Reflection.MethodInfo invoke) [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.330: E/Unity(13561): at System.Runtime.CompilerServices.CallSite`1[T].MakeUpdateDelegate () [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.330: E/Unity(13561): at System.Runtime.CompilerServices.CallSite`1[T].GetUpdateDelegate (T& addr) [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.330: E/Unity(13561): at System.Runtime.CompilerServices.CallSite`1[T]..ctor (System.Runtime.CompilerServices.CallSiteBinder binder) [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.330: E/Unity(13561): at System.Runtime.CompilerServices.Cal 01-12 15:44:00.340: E/Unity(13561): ArgumentNullException: Value cannot be null. 01-12 15:44:00.340: E/Unity(13561): Parameter name: method 01-12 15:44:00.340: E/Unity(13561): at System.Dynamic.Utils.ContractUtils.RequiresNotNull (System.Object value, System.String paramName) [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.340: E/Unity(13561): at System.Linq.Expressions.Expression.Call (System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0) [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.340: E/Unity(13561): at System.Runtime.CompilerServices.CallSite`1[T].CreateCustomNoMatchDelegate (System.Reflection.MethodInfo invoke) [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.340: E/Unity(13561): at System.Runtime.CompilerServices.CallSite`1[T].MakeUpdateDelegate () [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.340: E/Unity(13561): at System.Runtime.CompilerServices.CallSite`1[T].GetUpdateDelegate (T& addr) [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.340: E/Unity(13561): at System.Runtime.CompilerServices.CallSite`1[T]..ctor (System.Runtime.CompilerServices.CallSiteBinder binder) [0x00000] in <00000000000000000000000000000000>:0 01-12 15:44:00.340: E/Unity(13561): at System.Runtime.CompilerServices.Cal
Answer by trozwadowski · Jan 14, 2018 at 03:54 PM
So it seems that you cannot use dynamic with IL2CPP.
Yes, IL2CPP is an ahead-of-time compiler only. It does not support dynamic or System.Reflection.Emit.
Answer by Lobolopez · Jan 15, 2019 at 01:55 PM
@JoshPeterson Is this still true (jan '19)? What's the alternative? This is my situation (ios 12, Unity 2017, il2cpp):
public static class PortConverter
{ public static void Convert(float a, int b)
{
Debug.Log("called the typed convert");
}
}
public class Porto<T, M>
{
T a;
M b;
public Porto(T _a, M _b)
{
a = _a; b = _b;
}
public void doThat()
{
PortConverter.Convert((dynamic)a, (dynamic)b);
}
}
public class lala : MonoBehaviour {
Porto<float, int> a = new Porto<float, int>(1.0f,2);
void OnEnable () {
a.doThat();
}
}
That fails in what seems like the call to dynamic, is there a way around? Is there support for dynamic in the horizon?
thanks!
Your answer
Follow this Question
Related Questions
Error Building Android Project 2 Answers
Android build reports "Wrong task initialization" 1 Answer
Android project build is failing 1 Answer
Help with Exception: Error building Player on Android 2 Answers
Connect Andorid Phone and get error 1 Answer