Updated 1.5 Project gets Mono related SIGABRT in 1.6

I’ve got a project where I’ve got some “native” Obj-C functions called by c# scripts. Mostly Facebook Connect and some UIWebView stuff… This worked fine in 1.5 - now I get the errors below. This is after a clean build and a new XCode project. Using .NET 1.1, no stripping but I unchecked the networking support. Anyone else seeing this? I’ll condense it down into a bug report in the AM if needed.

(...)
Unity runtime class registered 5471888
Unity runtime class registered 5479092
2010-03-06 22:07:52.200 NativeGUI[1003:207] -> registered unity classes
2010-03-06 22:07:52.293 NativeGUI[1003:207] -> registered mono modules
 Bad call to mono_mutex_lock result 22* Assertion at /Users/mantasp/work/unity/unity-mono/External/Mono/mono/mono/metadata/object.c:1719, condition `ret == 0' not met
Program received signal:  “SIGABRT”.
mi_cmd_stack_list_frames: Not enough frames in stack.
mi_cmd_stack_list_frames: Not enough frames in stack.
(gdb) backtrace
#0  0x33994b2c in __kill ()
#1  0x33994b20 in kill ()
#2  0x33994b14 in raise ()
#3  0x339abe3a in abort ()
#4  0x0066a86c in g_logv () at iostream:76
#5  0x0066a8a4 in g_log () at iostream:76
#6  0x006f71c4 in mono_class_vtable () at iostream:76
#7  0x006f88a8 in mono_object_new () at iostream:76
#8  0x006fbb34 in mono_field_get_value_object () at iostream:76
#9  0x006b3f54 in ves_icall_System_ValueType_InternalGetHashCode () at iostream:76
#10 0x000c9328 in System_MonoCustomAttrs_GetCustomAttribute_System_Reflection_ICustomAttributeProvider_System_Type_bool () at iostream:76
#11 0x0003b90c in System_Type__cctor () at iostream:76
#12 0x2fffddf8 in ?? ()
#13 0x0027ed8c in wrapper_runtime_invoke_object_runtime_invoke_void_object_intptr_intptr_intptr () at iostream:76
#14 0x0072c98c in mono_jit_runtime_invoke () at iostream:76
#15 0x3390643e in malloc ()
#16 0x00000000 in ?? ()
(gdb)

Yes i’m get exactly the same crash when using the Unity Enhancement Pack when using it with iPhone Basic 1.6

erm why is there a jit_invoke given that JIT is removed on the iphone completely?

Hi,
have you tried to turn “fast script call” off? Anyway please make a small repro case and submit it as a bug report. Thanks!

Hi,

I’ve made a very minimal repro case for this and filed Case 335501. The problem is triggered by linking with the Facebook Connect API somehow. In Obj-C, I’ve implemented a category of the AppController where I setup some FBConnect structures. Simply declaring any FBDialog, FBSession or whatever pointers within my category implementation will cause the crash even if you don’t call that code at all. Weird. Sounds like linker problems to me but I can’t see it.

Mantas, can you reproduce this? I don’t want to roll back to 1.5.

That sounds somehow like the startup issues I’ve found and reported for AdMob (and Flurry, potentially any included static library), which both cause iPhone 1.6 to crash if stripping isn’t enabled.

I just introduced my first List<> into my game. The code runs perfectly in the Editor. But, on the iPhone, I either get a SIGABRT at the beginning, if I build with “Fast but no Exceptions”, or a SIGBUS when the relevant code is triggered, when using “Slow and Safe”.

Is .NET 2.1 useless on the device, or is there some way around this? In a Start function, I am creating a List<> based on an array. Is it possible that something isn’t able to handle that?

Xcode’s Console doesn’t seem to tell me anything useful when “Slow and Safe” is used, but here’s what I get with “Fast but no Exceptions”:

-> applicationDidFinishLaunching()
  

End Load File completely 203.861167


Unhandled Exception: System.ExecutionEngineException: Attempting to JIT compile method '(wrapper managed-to-managed) Fenestella[]:System.Collections.Generic.ICollection`1.get_Count ()' while running with --aot-only.

  at System.Collections.Generic.List`1[Fenestella]..ctor (IEnumerable`1 collection) [0x00000] 
  at FenTouch.Start () [0x00000] 
2010-04-23 12:40:18.594 Level2[924:5c73] *** Terminating app due to uncaught exception 'NSDestinationInvalidException', reason: '*** -[AppController performSelector:onThread:withObject:waitUntilDone:modes:]: target thread exited while waiting for the perform'
2010-04-23 12:40:18.598 Level2[924:5c73] Stack: (
    861696817,
    860329709,
    861252493,
    861252395,
    845968709,
    845967901,
    55468,
    846004025,
    845672609,
    848189713
)
terminate called after throwing an instance of 'NSException'
[Switching to thread 12291]
[Switching to thread 12291]
Program received signal:  “SIGABRT”.
(gdb)

Hi,

What iphone stripping level are you using? Have you tried to disable iphone stripping?

I don’t have Unity iPhone Pro.

Hmm… It should work™ :slight_smile: What type do you use for template specialization? Is it value type?
Please submit a bug report.

I don’t even know what this means. :slight_smile:

http://answers.unity3d.com/questions/8610/have-you-gotten-generic-lists-work-on-the-iphone

If you could let me know if they’re even supposed to work, I’d appreciate it. I can file a bug report, but anything involving a List<> results in a crash. If they only work in the Editor, that sucks. Because then, I have to use a larger build size for no reason on the device, just to get my Editor scripts not to generate errors.

Just for the thing throw in between on the EP: The EP out of the box does not work cause the included admob library is thumbcompiled
Unity iPhone 1.6+ does not work at all with thumb compiled library and crashes straight out on the unity initialization.
If you replace them with the thumb compiled library it will work again.

I mention this because this also holds for every other library you use. For a not understandable reason many libraries by default provide you the thumb compiled and offer the non thumb in an alternative not always obvious way

As for generics: some classes work, but others won’t because they rely on JIT for their handling as the corresponding information required would exist at runtime and at runtime you don’t have anything in AoT

I’ve replied on the Answers, List works for me on iPhone

I would like to add a comment to that, but comments can’t be long enough there, and if you can add code formatting there, I don’t know how, so I’m posting this here and adding a link to it there.

It was not a Player Settings issue, as like I said, the Lists work fine in the Editor, and you can’t use them in the Editor without changing the Player Settings. (It’s probably worth changing that to not be the case, if you’re going to keep the .NET 1.1 option around.)

Here is the main problem:
You can not serialize Generic Lists in Unity iPhone, so I was trying to do this:

public ReferenceType[] objectsArray;  // set up in Editor
void Start () 
{
     List<ReferenceType> objectsList = new List<ReferenceType>(objectsArray);
     objectsArray = null;
}

With a custom or Unity-supplied class, that constructor causes a SIGABRT every single time. It does not appear to be a problem with value types, but that’s not what my code requires. Using this seem to be solving the problem now…

List<ReferenceType> objectsList = new List<ReferenceType>();
for (int i = 0; i < objectsArray.Length; ++i)
     objectsList.Add(objectsArray[i]);

but it had not been, before. I had the problem two days ago, where I was getting SIGBUS errors upon build, without apparent reason, and the way I solved that was by restarting Unity iPhone. For now, I’ll assume that whatever bug caused that to happen, was also why Add() did not work before. I’ll file a report if I ever find out how to reproduce that.

For the time being, UT should either make that constructor work, for refrences types, or provide a warning message. It should not generate an error, because it works in the Editor, and is therefore useful for Editor-only code. Let me know if you need me to file a bug report on this, and then I think I can call that question answered, and help others to learn of the current limitations.

please see the example I’ve attached to this post. It may help you.

310651–10964–$serialisations_659.cs (1.42 KB)

I’m not sure about that. My class will serialize just fine. It’s List<> that won’t. Let me know if you think that I can make List<> serializable with that, but I don’t think I know enough on my own to figure that out.

Regardless, though, I would like to know if you need me to file a bug about that constructor issue.