- Home /
How to get readable stacktrace in IOS build?
I got the following stacktrace when running ipad build in xcode. How to fill in the blanks, e.g. replace :0 with actual filename and line number ? I did debug build, checked development build option, set "full" stack traces in options, I use ios 10.1. Also the code works on windows but after il2cpp it gives me that error. Is il2cpp reliable?
NullReferenceException: Object reference not set to an instance of an object.
at System.Linq.Expressions.Interpreter.LightLambda.MakeRunDelegateCtor (System.Type delegateType) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Expressions.Interpreter.LightLambda.GetRunDelegateCtor (System.Type delegateType) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Expressions.Interpreter.LightLambda.MakeDelegate (System.Type delegateType) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Expressions.Expression`1[TDelegate].Compile (System.Boolean preferInterpretation) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.CallSite`1[T].MakeUpdateDelegate () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.CallSite`1[T].GetUpdateDelegate (T& addr) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.CallSite`1[T]..ctor (System.Runtime.CompilerServices.CallSiteBinder binder) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.CallSite`1[T].Create (System.Runtime.CompilerServices.CallSiteBinder binder) [0x00000] in <00000000000000000000000000000000>:0
at Company.Project.insertObjectArray[TCompanyObject] (System.Collections.Generic.List`1[T] objectArray, Company.IProgressInterface progressInterface) [0x00000] in <00000000000000000000000000000000>:0
at Company.Project.insert (CCompanyAPIProjectData projectData, Company.IProgressInterface progressInterface, System.String progressLabelBase) [0x00000] in <00000000000000000000000000000000>:0
at Company.Project.ReplaceProjectData (CCompanyAPIProjectData newProjectData, Company.IProgressInterface progressInterface) [0x00000] in <00000000000000000000000000000000>:0
at ProjectDataLoader+<LoadProject>d__18.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
Answer by JoshPeterson · Feb 05, 2020 at 12:52 PM
IL2CPP does not support C# line numbers in stack traces at the moment, so there is nothing you can do to get them.
Note that in general, the C# Linq expression interpreter (which is where this exception is coming from) doesn't work too well with IL2CPP. There is a thread here with some details:
https://forum.unity.com/threads/are-c-expression-trees-or-ilgenerator-allowed-on-ios.489498/
You will need at least a link.xml in the project with these contents:
<linker>
<assembly fullname="System.Core">
<type fullname="System.Linq.Expressions.Interpreter.LightLambda" preserve="all" />
</assembly>
</linker>
Even then, you might hit case that IL2CPP cannot handle. I'd recommend against using the LINQ expression interpreter if possible.
Thanks! It seems that exception comes from the line: insert(object as dynamic); I found another thread that mentions that il2cpp does not support dynamic keyword (dotnet 4 feature). So, a lot of restrictions when using il2cpp, It would be nice to know what subset of .net 4.x features are supported before writing the code. Because it compiles, works on windows and then does not work in production environment (iPad).
We don't have an exhaustive list of things that don't work with IL2CPP, although this documentation does exist: https://docs.unity3d.com/$$anonymous$$anual/ScriptingRestrictions.html
In general, IL2CPP is an ahead-of-time compiler, so it cannot support run time code generation, which is required for dynamic to work. Likewise, iOS does not support run time code generation at all.
Your answer
Follow this Question
Related Questions
IOS append not working? 0 Answers
Xcode build & run "innocent" (?) problem 0 Answers
PBXProject and UNITY_IOS issue in PostProcessBuild step on 2018.1 0 Answers
Unity 2019 iOS build problem 0 Answers