Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

WebGL build shows error popup, but no errors when exceptions are enabled

Discussion in 'WebGL' started by joonturbo, Jul 15, 2015.

  1. joonturbo

    joonturbo

    Joined:
    Jun 24, 2013
    Posts:
    75
    My WebGL build shows this popup whenever I run it


    Here's the console log of Firefox: http://pastebin.com/hRWQaciS

    I went in an enabled the Exception logging, set it to full



    Then no errors appear in the console, and the build actually works fine.
    The Firefox console reads this.

    Code (CSharp):
    1. Successfully compiled asm.js code (loaded from cache in 879ms) ffa_webgl.js
    2. "run() called, but dependencies remain, so not running" ffa_webgl:34:7
    3.  
    4. "loading ffa_webgl.data from remote" fileloader.js:277:17
    5. "pre-main prep time: 2810 ms" ffa_webgl:34:7
    6.  
    7. "PlayerConnection initialized from  (debug = 0)" ffa_webgl:30:9
    8. "PlayerConnection disabled  - listening mode not supported" ffa_webgl:30:9
    9. "Initialize engine version: 5.1.1p4 (c439df19cd24)" ffa_webgl:30:9
    10. "Creating WebGL 1.0 context." ffa_webgl:30:9
    11. "Renderer: Mozilla" ffa_webgl:30:9
    12. "Vendor:   Mozilla" ffa_webgl:30:9
    13. "Version:  WebGL 1.0" ffa_webgl:30:9
    14. "GLES:     0" ffa_webgl:30:9
    15. "ANGLE_instanced_arrays GL_ANGLE_instanced_arrays EXT_blend_minmax GL_EXT_blend_minmax EXT_color_buffer_half_float GL_EXT_color_buffer_half_float EXT_frag_depth GL_EXT_frag_depth EXT_shader_texture_lod GL_EXT_shader_texture_lod EXT_texture_filter_anisotropic GL_EXT_texture_filter_anisotropic OES_element_index_uint GL_OES_element_index_uint OES_standard_derivatives GL_OES_standard_derivatives OES_texture_float GL_OES_texture_float OES_texture_float_linear GL_OES_texture_float_linear OES_texture_half_float GL_OES_texture_half_float OES_texture_half_float_linear GL_OES_texture_half_float_linear OES_vertex_array_object GL_OES_vertex_array_object WEBGL_color_buffer_float GL_WEBGL_color_buffer_float WEBGL_compressed_texture_s3tc GL_WEBGL_compressed_texture_s3tc WEBGL_depth_texture GL_WEBGL_depth_texture WEBGL_draw_buffers GL_WEBGL_draw_buffers WEBGL_lose_context GL_WEBGL_lose_context MOZ_WEBGL_lose_context GL_MOZ_WEBGL_lose_context MOZ_WEBGL_compressed_texture_s3tc GL_MOZ_WEBGL_compressed_texture_s3tc MOZ_WEBGL_dep" ffa_webgl:30:9
    16. "th_texture GL_MOZ_WEBGL_depth_texture" ffa_webgl:30:9
    17. "OPENGL LOG: Creating OpenGL ES 2.0 graphics device" ffa_webgl:30:9
    18. "Unloading 4 Unused Serialized files (Serialized files now loaded: 0)" ffa_webgl:30:9
    What could be the cause of that, and would you advise using Enable Exceptions = Full in a released game?
     
    Last edited: Jul 16, 2015
    siddharth3322 likes this.
  2. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    The cause of that will be that the exception is thrown and caught as expected, and everything works.

    But, no, we don't recommend using Enable Exceptions = Full in a released game. You can try using "Explicitly Thrown Exception only" mode, which will likely also work, and is much faster. Or turn inspections off again, and see the browser console for a stack trace of your exception and see if you can fix it.
     
  3. joonturbo

    joonturbo

    Joined:
    Jun 24, 2013
    Posts:
    75
    you mean just set enable exceptions to none? Cause that throws an error.
    I will try out Explicitly thrown errors only.
     
  4. joonturbo

    joonturbo

    Joined:
    Jun 24, 2013
    Posts:
    75
    Enable Exceptions = excplicitly thrown errors only also works, but I am still unsure how I could get a readable stacktrace.
    The only time I saw a stracktrace is when I built with Enable Exceptions = none, and it looked like this

    Code (CSharp):
    1. "Exception at:
    2. jsStackTrace@http://localhost/ffa_webgl/Development/ffa_webgl.js:1003:12
    3. stackTrace@http://localhost/ffa_webgl/Development/ffa_webgl.js:1017:21
    4. ___cxa_throw@http://localhost/ffa_webgl/Development/ffa_webgl.js:20:36
    5. __ZN6il2cpp2vm9Exception5RaiseEP15Il2CppException [il2cpp::vm::Exception::Raise(Il2CppException?*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1603801:2
    6. _il2cpp_raise_exception@http://localhost/ffa_webgl/Development/ffa_webgl.js:2027469:2
    7. __ZN9Scripting24RaiseDotNetExceptionImplEPKcS1_S1_Pi [Scripting::RaiseDotNetExceptionImpl?S(char*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1858921:2
    8. __ZN9Scripting24RaiseSystemExceptionImplEPKcS1_Pi [Scripting::RaiseSystemExceptionImpl?S(char*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1909498:2
    9. __ZN9Scripting18RaiseNullExceptionEPKcz [Scripting::RaiseNullException(char*, ...)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1927324:2
    10. __Z37AsyncOperation_CUSTOM_InternalDestroyP15ScriptingObject [AsyncOperation_CUSTOM_InternalDestroy(ScriptingObject?*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1887188:2
    11. _AsyncOperation_InternalDestroy_m5617@http://localhost/ffa_webgl/Development/ffa_webgl.js:1940426:2
    12. _AsyncOperation_Finalize_m5618@http://localhost/ffa_webgl/Development/ffa_webgl.js:1957520:2
    13. __Z25RuntimeInvoker_Void_t2314PK10MethodInfoPvPS2_ [RuntimeInvoker_Void_t2314?2(void**, undefined?S?*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1972773:2
    14. __ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP12Il2CppObject [il2cpp::vm::Runtime::Invoke?5(void**, undefined?S?*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1906395:9
    15. __Z22il2cpp_gc_run_finalizePvS_ [il2cpp_gc_run_finalize?S(void*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1887200:2
    16. _GC_gcj_malloc@http://localhost/ffa_webgl/Development/ffa_webgl.js:1010980:6
    17. __ZN6il2cpp2vm6Object16NewAllocSpecificEP8TypeInfo [il2cpp::vm::Object::NewAllocSpecific(TypeInfo?*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1340830:9
    18. __ZN6il2cpp2vm6Object3NewEP8TypeInfo [il2cpp::vm::Object::New(TypeInfo?*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:2004577:9
    19. _il2cpp_object_new@http://localhost/ffa_webgl/Development/ffa_webgl.js:2031168:9
    20. __Z20scripting_object_newP14ScriptingClass [scripting_object_new(ScriptingClass?*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:2028395:9
    21. __ZN13MonoBehaviour19RebuildMonoInstanceEP14ScriptingClassP15ScriptingObjectP10MonoScript [MonoBehaviour::RebuildMonoInstance(MonoScript?***)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:687269:7
    22. __ZN17PersistentManager21ProduceObjectInternalER14SerializedFile26SerializedObjectIdentifierii [PersistentManager::ProduceObjectInternal?6(SerializedFile?2?&)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:772219:2
    23. __ZN17PersistentManager32CreateThreadActivationQueueEntryER14SerializedFile26SerializedObjectIdentifierib [PersistentManager::CreateThreadActivationQueueEntry?6(SerializedFile?2?&)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1138408:8
    24. __ZN17PersistentManager25PreallocateObjectThreadedEi [PersistentManager::PreallocateObjectThreaded(int)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:859740:10
    25. __Z38PreallocateObjectFromPersistentManagerib [PreallocateObjectFromPersistentManager(int, bool)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1827309:8
    26. __ZN12ImmediatePtrIN5Unity9ComponentEE8TransferI18StreamedBinaryReadILb0EEEEvRT_ [undefined Transfer<void, undefined?T?&, undefined StreamedBinaryRead<0>?_?>? ImmediatePtr<Unity::Component?>()]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1209925:22
    27. __ZN18StreamedBinaryReadILb0EE21TransferSTLStyleArrayI13dynamic_arrayINSt3__14pairIi12ImmediatePtrIN5Unity9ComponentEEEELj4EEEEvRT_17TransferMetaFlags [T?r? StreamedBinaryRead<0, undefined?2?>?n(signed char)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1099653:4
    28. __ZN5Unity10GameObject8TransferI18StreamedBinaryReadILb0EEEEvRT_ [undefined Unity::GameObject::Transfer<void, undefined?T?&, undefined StreamedBinaryRead<0>?_?>()]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1463799:34
    29. __ZN5Unity10GameObject23VirtualRedirectTransferER18StreamedBinaryReadILb0EE [Unity::GameObject::VirtualRedirectTransfer(undefined StreamedBinaryRead<0>?&)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1916288:2
    30. __ZN14SerializedFile10ReadObjectEx18ObjectCreationModebPPK8TypeTreePbR6Object [SerializedFile::ReadObject?1(long long)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:534661:3
    31. __ZN17PersistentManager26LoadFileCompletelyThreadedERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPxPiibR12LoadProgress [PersistentManager::LoadFileCompletelyThreaded?S(undefined?N?&)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:491697:7
    32. __ZN18LoadSceneOperation7PerformEv [LoadSceneOperation::Perform()]@http://localhost/ffa_webgl/Development/ffa_webgl.js:313109:2
    33. __ZN14PreloadManager26UpdatePreloadingSingleStepENS_21UpdatePreloadingFlagsE [PreloadManager::UpdatePreloadingSingleStep?N()]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1231909:3
    34. __ZN14PreloadManager16UpdatePreloadingEv [PreloadManager::UpdatePreloading()]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1486052:3
    35. __Z10PlayerLoopbbP10IHookEvent [PlayerLoop(bool, bool, IHookEvent?*)]@http://localhost/ffa_webgl/Development/ffa_webgl.js:239537:3
    36. __ZL8mainloopv [mainloop()]@http://localhost/ffa_webgl/Development/ffa_webgl.js:1832964:2
    37. dynCall_v@http://localhost/ffa_webgl/Development/ffa_webgl.js:2041242:2
    38. Runtime.dynCall@http://localhost/ffa_webgl/Development/ffa_webgl.js:224:11
    39. Browser_mainLoop_runner/<@http://localhost/ffa_webgl/Development/ffa_webgl.js:9135:5
    40. Browser.mainLoop.runIter@http://localhost/ffa_webgl/Development/ffa_webgl.js:10414:5
    41. Browser_mainLoop_runner@http://localhost/ffa_webgl/Development/ffa_webgl.js:9131:3
    42. " ffa_webgl.js:20:1
    43. "Invoking error handler due to
    44. uncaught exception: undefined - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch." UnityConfig.js:76:9
    45. uncaught exception: undefined - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch. <unknown>
     
  5. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Yes, that is the stack trace I was referring to. However, the error does not look like something in your code or something you could possibly fix. That does look like it could be a bug in Unity or IL2CPP. Could you file a bug report with a repro case? (And post the bug number here)
     
  6. dark_end

    dark_end

    Joined:
    Jun 24, 2015
    Posts:
    5
    I was having the same problem and I narrowed it down to Color.TryParseHexValue

    Apparently for some reason an exception is thrown if the Value isn't a valid Hex Value.
    Building with no-exception handling caused my app to crash as soon as Color.TryParseHexValue tried to parse a non-hex color string. Enabling exception handling didn't cause any errors at all.

    After adding a guard statement in front of the Color.TryParseHexValue call, checking for first character being a "#" this problem does not occur anymore.

    Yes, I am handling everything properly if the value cannot be parsed as color... because in that case its a Texture name that I load from the resources folder.