.AddListener call on uGUI causing WebGL crash

Hi Marco & Jonas, got one more.

This one looks pretty straight forward, binding a uGUI event at runtime using the .AddListener method (in this case, it’s on a .onClick on a UGUI Button), causes a WebGL crash. Stack trace as follows.

An error occured running the Unity content on this page. See your browser's JavaScript console for more info. The error was:
uncaught exception: abort(241) at jsStackTrace@http://domain.com/assets/webgl/Development/WebGL.js:995:12
stackTrace@http://domain.com/assets/webgl/Development/WebGL.js:1009:21
abort@http://domain.com/assets/webgl/Development/WebGL.js:4324294:43
nullFunc_viii@http://domain.com/assets/webgl/Development/WebGL.js:15501:2
b241@http://domain.com/assets/webgl/Development/WebGL.js:4303807:2
__ZN18VirtActionInvoker1IP23BaseInvokableCall_t5408E6InvokeEjPvS1_ [void undefined<undefined?n?>?o? VirtActionInvoker1<BaseInvokableCall_t5408?*, undefined?6?>?k()]@http://domain.com/assets/webgl/Development/WebGL.js:3945984:2
_UnityEventBase_AddCall_m25840@http://domain.com/assets/webgl/Development/WebGL.js:4142989:2
_UnityEvent_AddListener_m22618@http://domain.com/assets/webgl/Development/WebGL.js:4172905:2
_InventoryVendor_Start_m18162@http://domain.com/assets/webgl/Development/WebGL.js:2206126:2
__Z25RuntimeInvoker_Void_t5923PK10MethodInfoPvPS2_ [RuntimeInvoker_Void_t5923?2(void**, undefined?S?*)]@http://domain.com/assets/webgl/Development/WebGL.js:4181236:2
dynCall_iiii@http://domain.com/assets/webgl/Development/WebGL.js:4199256:9
invoke_iiii@http://domain.com/assets/webgl/Development/WebGL.js:16704:10
__ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP12Il2CppObject [il2cpp::vm::Runtime::Invoke?5(void**, undefined?S?*)]@http://domain.com/assets/webgl/Development/WebGL.js:3458193:8
_il2cpp_runtime_invoke@http://domain.com/assets/webgl/Development/WebGL.js:4162817:9
__Z20il2cpp_invoke_method21ScriptingMethodIl2CppP15ScriptingObjectP18ScriptingArgumentsPP18ScriptingExceptionb [il2cpp_invoke_method?2()]@http://domain.com/assets/webgl/Development/WebGL.js:3694467:8
__ZN19ScriptingInvocation6InvokeEPP18ScriptingExceptionb [ScriptingInvocation::Invoke(bool**)]@http://domain.com/assets/webgl/Development/WebGL.js:2645710:7
__ZN19ScriptingInvocation6InvokeEPP18ScriptingException [ScriptingInvocation::Invoke(ScriptingException?**)]@http://domain.com/assets/webgl/Development/WebGL.js:4178620:9
__ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE21ScriptingMethodIl2CppP15ScriptingObjectPP18ScriptingException [MonoBehaviour::InvokeMethodOrCoroutineChecked?2()]@http://domain.com/assets/webgl/Development/WebGL.js:934447:9
__ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE21ScriptingMethodIl2CppP15ScriptingObject [MonoBehaviour::InvokeMethodOrCoroutineChecked?2()]@http://domain.com/assets/webgl/Development/WebGL.js:2420332:7
__ZN13MonoBehaviour16DelayedStartCallEP6ObjectPv [MonoBehaviour::smile:elayedStartCall(void**)]@http://domain.com/assets/webgl/Development/WebGL.js:3073312:2
__ZN18DelayedCallManager6UpdateEi [DelayedCallManager::Update(int)]@http://domain.com/assets/webgl/Development/WebGL.js:1387237:9
__Z10PlayerLoopbbP10IHookEvent [PlayerLoop(bool, bool, IHookEvent?*)]@http://domain.com/assets/webgl/Development/WebGL.js:467273:3
__ZL8mainloopv [mainloop()]@http://domain.com/assets/webgl/Development/WebGL.js:3882905:2
dynCall_v@http://domain.com/assets/webgl/Development/WebGL.js:4315707:2
Runtime.dynCall@http://domain.com/assets/webgl/Development/WebGL.js:216:11
Browser_mainLoop_runner/<@http://domain.com/assets/webgl/Development/WebGL.js:9141:5
Browser.mainLoop.runIter@http://domain.com/assets/webgl/Development/WebGL.js:10421:5
Browser_mainLoop_runner@http://domain.com/assets/webgl/Development/WebGL.js:9137:3

This might be a bug, any chance you could file a repro case?

I can file a bug - I do have it reproable in our project (but it’s filesize huge, so I can’t upload it all unfortunately), I can upload the offending Monobehaviour code file (it is pretty small), but I’m not 100% certain if it will trigger the bug outside our project.