I received an ERA report, which call stack looked little weird, and didn't really make sense. Basically it was showing "symbol not found" crash on line which would not cause it.
Below is the code in question, modified for this demonstration:
function updateAllDevices() { for (var device = 0; device < itemArray.size(); device++ ) { if (itemArray[device] instanceof ItemOne) { updateItemOne(itemArray[device]); } else if (itemArray[device] instanceof ItemTwo) { updateItemTwo(itemArray[device]); } } adjustItems(); }
From this, I'd get a following call stack:
updateAllDevices: line 9
updateAllDevices: line 4
etc...
I mean, how can call stack be two times in row from same function (it's not recursive function)? Anyway, I did find bug that would cause crash, inside updateItemOne(). "updateAllDevices: line 4" does indicate problem is somewhere inside that function, since line 9 doesn't make sense.
I was wondering what is going on, and tried to reproduce the error on simulator. I soon realised I cannot step inside function updateItemOne() at all (or updateItemTwo() for the matter at all), it would just execute the function, but remain in updateAllDevices() (like I was stepping over instead of stepping in). Also the breakpoints inside these functions didn't trigger.
UpdateItemOne() and updateItemTwo() were private functions, so just for curiosity I changed them to public. Immediately I was able to step into the functions, and use breakpoints inside them. This was quite surprising to me, I'd think private property would not have such impact. So now I think having private functions may have confused the ERA crash report too.
On simulator I always get correct crash call stack, and also on my actual device when looking into CIQ_LOG.xml. So I cannot reproduce that myself. I did notice that private functions do not have debug information in debug.xml file. Perhaps this is used by ERA when parsing call stack from release version, and it gets confused by missing information?
Has anyone else notices similar issues with private functions, or is it just me and I have missed something significant about them? For now I have removed private property from everywhere since I don't really need them, they were just there for attempt of nice coding style.