moonsharp icon indicating copy to clipboard operation
moonsharp copied to clipboard

Unity 2017.1 WebGL build crashes on Lua script run

Open greymag opened this issue 8 years ago • 4 comments

Any code, for example Script.RunString("return 5"); crashes in webgl build

abort(150) at jsStackTrace (WebGL.asm.framework.unityweb:1218:21)
stackTrace (WebGL.asm.framework.unityweb:1232:23)
abort (WebGL.asm.framework.unityweb:442185:53)
nullFunc_iiiiiiiii (WebGL.asm.framework.unityweb:28754:7)
b150 (WebGL.asm.framework.unityweb:435234:20)
ftCall_iiiiiiiii
mftCall_iiiiiiiii
_Type_GetProperty_m2186896821
_FrameworkClrBase_GetProperty_m127743816

ftCall_iiiii
invoke_iiiii
_UnityAssetsScriptLoader_LoadResourcesWithReflection_m1513129289
_UnityAssetsScriptLoader__ctor_m2607121316
_PlatformAutoDetector_GetDefaultScriptLoader_m4271947063
_Script__cctor_m248437805
mftCall_vii
__Z30RuntimeInvoker_Void_t208002575PFvvEPK10MethodInfoPvPS4_ [RuntimeInvoker_Void_t208002575(void (*)(), MethodInfo const*, void*, void**)]

ftCall_iiiii
invoke_iiiii
__ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException [il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)]
__ZN6il2cpp2vm7Runtime9ClassInitEP11Il2CppClass [il2cpp::vm::Runtime::ClassInit(Il2CppClass*)]
_Test_MoonSharpTest_m638106588
_Test_Start_m1672059298
mftCall_vii
__Z30RuntimeInvoker_Void_t208002575PFvvEPK10MethodInfoPvPS4_ [RuntimeInvoker_Void_t208002575(void (*)(), MethodInfo const*, void*, void**)]

ftCall_iiiii
invoke_iiiii
__ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException [il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)]
_il2cpp_runtime_invoke

_il2cpp_runtime_invoke (WebGL.asm.framework.unityweb:11525:47)
__Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb (WebGL.asm.code.unityweb:2647480:30)
__ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb (WebGL.asm.code.unityweb:1887963:121)
__ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtrP21ScriptingExceptionPtr (WebGL.asm.code.unityweb:619456:67)
__ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtr (WebGL.asm.code.unityweb:1801858:123)
__ZN13MonoBehaviour16DelayedStartCallEP6ObjectPv (WebGL.asm.code.unityweb:2271629:94)
mftCall_iii (WebGL.asm.code.unityweb:2796022:98)
__ZN18DelayedCallManager6UpdateEi (WebGL.asm.code.unityweb:1106497:44)
mftCall_vii (WebGL.asm.code.unityweb:2798095:37)
__ZZ23InitPlayerLoopCallbacksvEN50EarlyUpdateScriptRunDelayedStartupFrameRegistrator7ForwardEv (WebGL.asm.code.unityweb:2689563:13)
mftCall_v (WebGL.asm.code.unityweb:2833458:35)
__Z10PlayerLoopv (WebGL.asm.code.unityweb:811467:23)
__ZL8MainLoopv (WebGL.asm.code.unityweb:2103087:19)
blob:http://localhost:64096/278ca9de-2d78-44ee-8b5e-af0a1d326299:203999:34
ftCall_v (WebGL.asm.framework.unityweb:29725:28)
browserIterationFunc (WebGL.asm.framework.unityweb:2951:23)
runIter (WebGL.asm.framework.unityweb:3054:9)

In console I see error

Invalid function pointer called with signature 'iiiiiiiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)

It's stop crashing if I set "Enable Exception" to "Full" in publishing setting (http://d.pr/i/Tmshs), but this is not acceptable for release.

greymag avatar Oct 03 '17 15:10 greymag

It crashes for me too in WebGL with Unity 2017.2. Would be so great to have a working example.

ancientc avatar Dec 01 '17 00:12 ancientc

After eight hours of crashes and javascript error debug I ask for help. I hereby offer 30 USD (paypal) to anyone who delivers me a project that compiles a working Moonsharp WebGL build on Unity 2017.2. ( Basic script running should work, at least 80% of Moonsharp functionality should work.) Deadline 3.Dec 2017

ancientc avatar Dec 01 '17 07:12 ancientc

I too am having this issue. Tried both the Unity store plugin and the generic dll with link.xml. No dice.

Here's my stack trace:

An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
uncaught exception: abort(174) at jsStackTrace (WebGL.asm.framework.unityweb:2:27491)
stackTrace (WebGL.asm.framework.unityweb:2:27662)
abort (WebGL.asm.framework.unityweb:4:37710)
B_x (WebGL.asm.code.unityweb:32:1)
d0m (WebGL.asm.code.unityweb:19:1)
dTp (WebGL.asm.code.unityweb:9:1)
LOx (WebGL.asm.code.unityweb:32:1)
invoke_iiiii (WebGL.asm.framework.unityweb:2:343721)
Gwl (WebGL.asm.code.unityweb:17:1)
Fwl (WebGL.asm.code.unityweb:17:1)
Uzl (WebGL.asm.code.unityweb:17:1)
QAl (WebGL.asm.code.unityweb:17:1)
quf (WebGL.asm.code.unityweb:29:1)
LOx (WebGL.asm.code.unityweb:32:1)
invoke_iiiii (WebGL.asm.framework.unityweb:2:343721)
kNw (WebGL.asm.code.unityweb:30:1)
zNw (WebGL.asm.code.unityweb:30:1)
Dzx (WebGL.asm.code.unityweb:30:1)
FIt (WebGL.asm.code.unityweb:8:1)
EIt (WebGL.asm.code.unityweb:8:1)
GIt (WebGL.asm.code.unityweb:8:1)
hzx (WebGL.asm.code.unityweb:30:1)
BDx (WebGL.asm.code.unityweb:30:1)
wDx (WebGL.asm.code.unityweb:30:1)
AGx (WebGL.asm.code.unityweb:32:1)
Sth (WebGL.asm.code.unityweb:4:1)
hLt (WebGL.asm.code.unityweb:7:1)
fLt (WebGL.asm.code.unityweb:7:1)
cLt (WebGL.asm.code.unityweb:7:1)
bLt (WebGL.asm.code.unityweb:7:1)
_Kt (WebGL.asm.code.unityweb:7:1)
ZKt (WebGL.asm.code.unityweb:7:1)
quf (WebGL.asm.code.unityweb:29:1)
LOx (WebGL.asm.code.unityweb:32:1)
invoke_iiiii (WebGL.asm.framework.unityweb:2:343721)
kNw (WebGL.asm.code.unityweb:30:1)
lZw (WebGL.asm.code.unityweb:30:1)
QT (WebGL.asm.code.unityweb:15:1)
PT (WebGL.asm.code.unityweb:15:1)
dIc (WebGL.asm.code.unityweb:11:1)
hIc (WebGL.asm.code.unityweb:11:1)
nsb (WebGL.asm.code.unityweb:23:1)
NHc (WebGL.asm.code.unityweb:11:1)
RHc (WebGL.asm.code.unityweb:11:1)
LHc (WebGL.asm.code.unityweb:11:1)
KHc (WebGL.asm.code.unityweb:11:1)
GHc (WebGL.asm.code.unityweb:11:1)
Pub (WebGL.asm.code.unityweb:21:1)
Pub (WebGL.asm.code.unityweb:21:1)
Iub (WebGL.asm.code.unityweb:21:1)
wub (WebGL.asm.code.unityweb:23:1)
cPx (WebGL.asm.code.unityweb:32:1)
browserIterationFunc (WebGL.asm.framework.unityweb:2:50424)
runIter (WebGL.asm.framework.unityweb:2:53516)
Browser_mainLoop_runner (WebGL.asm.framework.unityweb:2:51961)

If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.```

SlimeQ avatar Jun 06 '18 20:06 SlimeQ

@ancientc @greymag

This PR fixes the problem for me, not sure why it was never merged https://github.com/xanathar/moonsharp/pull/146

SlimeQ avatar Jun 06 '18 21:06 SlimeQ