Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Random Crash on TMPro_UGUI_Private.OnValidate

Discussion in 'UGUI & TextMesh Pro' started by CDF, Sep 17, 2020.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,307
    Using Unity, 2020.1.5f1
    TMP 3.0.1

    I don't think this is a TMP Problem, but a Unity AssetDatabase V2 problem.
    This seems to happen at random during a script reload/asset database refresh

    Code (CSharp):
    1. ========== OUTPUTTING STACK TRACE ==================
    2.  
    3. 0x000002C09689DCE6 (Mono JIT Code) [D:\Work\SMG\Sping\Library\PackageCache\com.unity.textmeshpro@3.0.1\Scripts\Runtime\TMPro_UGUI_Private.cs:270] TMPro.TextMeshProUGUI:OnValidate ()
    4. 0x000002C12E89C260 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    5. 0x00007FFA8302D8C0 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
    6. 0x00007FFA82FB2912 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2921] do_runtime_invoke
    7. 0x00007FFA82FBB96F (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2968] mono_runtime_invoke
    8. 0x00007FF6EA39FCD4 (Unity) scripting_method_invoke
    9. 0x00007FF6EA3997FB (Unity) ScriptingInvocation::Invoke
    10. 0x00007FF6EA399ABE (Unity) ScriptingInvocation::InvokeChecked
    11. 0x00007FF6EA409093 (Unity) SerializableManagedRef::CallMethod
    12. 0x00007FF6EA362D00 (Unity) MonoBehaviour::CheckConsistency
    13. 0x00007FF6EA361724 (Unity) MonoBehaviour::AwakeAfterRestoreFromBackup
    14. 0x00007FF6EA408AE2 (Unity) SerializableManagedRefsUtilities::AwakeInstancesAfterBackupRestoration
    15. 0x00007FF6EA3643CD (Unity) MonoManager::EndReloadAssembly
    16. 0x00007FF6EA36AA39 (Unity) MonoManager::ReloadAssembly
    17. 0x00007FF6EB5003E3 (Unity) ReloadAllUsedAssemblies
    18. 0x00007FF6EAF9A3AC (Unity) Application::TickTimer
    19. 0x00007FF6EB79BAE4 (Unity) MainMessageLoop
    20. 0x00007FF6EB7A4E7E (Unity) WinMain
    21. 0x00007FF6ED420916 (Unity) __scrt_common_main_seh
    22. 0x00007FFAE9576FD4 (KERNEL32) BaseThreadInitThunk
    23. 0x00007FFAEB41CEC1 (ntdll) RtlUserThreadStart
    24.  
    25. ========== END OF STACKTRACE ===========
    26.  
    I myself am always hitting random crashes in my own scripts and other Unity packages in 2020.1 that use OnValidate
    It's a total crash fest some days.

    Something is very wrong with AssetDatabase V2
     
  2. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,307
    5 mins after position and another crash (unrelated to TMP)

    Code (CSharp):
    1. ========== OUTPUTTING STACK TRACE ==================
    2.  
    3. 0x00007FF6EA3C5F37 (Unity) TransferField_NonArray<StreamedBinaryWrite,Converter_SimpleNativeClass<RectOffset> >
    4. 0x00007FF6EA3EA0EB (Unity) Transfer_SimpleNativeClass<StreamedBinaryWrite,RectOffset,0>
    5. 0x00007FF6E8E278FB (Unity) ExecuteSerializationCommands<ConfigSettingsRead>
    6. 0x00007FF6E9EF032C (Unity) TransferScriptingObject<StreamedBinaryWrite,1>
    7. 0x00007FF6E9F0225D (Unity) SerializableManagedRefBackupGenerator::ExtractBackupFromInstance
    8. 0x00007FF6EA361AF8 (Unity) MonoBehaviour::BackupAndDeflateManagedReferences
    9. 0x00007FF6EA408D43 (Unity) SerializableManagedRefsUtilities::BackupAndDeflateAll
    10. 0x00007FF6EA3620C2 (Unity) MonoManager::BeginReloadAssembly
    11. 0x00007FF6EA36A945 (Unity) MonoManager::ReloadAssembly
    12. 0x00007FF6EB5003E3 (Unity) ReloadAllUsedAssemblies
    13. 0x00007FF6EAF9A3AC (Unity) Application::TickTimer
    14. 0x00007FF6EB79BAE4 (Unity) MainMessageLoop
    15. 0x00007FF6EB7A4E7E (Unity) WinMain
    16. 0x00007FF6ED420916 (Unity) __scrt_common_main_seh
    17. 0x00007FFAE9576FD4 (KERNEL32) BaseThreadInitThunk
    18. 0x00007FFAEB41CEC1 (ntdll) RtlUserThreadStart
    19.  
    20. ========== END OF STACKTRACE ===========
    Seriously Unity, you're killing me
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Is this in a build?
     
  4. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,307
    No in Editor
     
  5. gregcodercw

    gregcodercw

    Joined:
    Dec 5, 2017
    Posts:
    15
    Any resolution to this issue? I've had it on and off in various versions of 2020.1 and then it went away. Now it's back in 2020.2.
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What version of the TMP package are you using?

    Do you also have a call stack?
     
  7. starstablesimon

    starstablesimon

    Joined:
    Nov 24, 2016
    Posts:
    18
    I wonder if we are having similar problems.
    Running Unity 2019.4.19 and it only happens on Asset Database V2, if we downgrade to V1 it doesn't happen.
    And it mostly happens after you made a git pull and someone has changed something.

    Attaching stack and code,

    Code (CSharp):
    1.  
    2. ========== OUTPUTTING STACK TRACE ==================
    3.  
    4. 0x00007FFBC4F48E35 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\mini\aot-runtime.c:2507] mono_aot_get_cached_class_info
    5. 0x00007FFBC4D8BD50 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\class.c:5039] mono_class_init
    6. 0x00007FFBC4D8CB62 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\class.c:8173] mono_class_is_subclass_of
    7. 0x00007FF7408F3A50 (Unity) scripting_class_has_parent
    8. 0x00007FF7408DE2CF (Unity) ComponentMatchesRequirement_ByScriptingClassNoInterface
    9. 0x00007FF7408DB450 (Unity) GetComponentsImplementation<1,1>
    10. 0x00007FF7408DBBDC (Unity) GetComponentsImplementationRecurse<1,0,1>
    11. 0x00007FF7408DCBF0 (Unity) GetComponentsOfTypeFromGameObject<1,0>
    12. 0x00007FF7408DFD41 (Unity) ScriptingGetComponentsOfTypeFromGameObject
    13. 0x00007FF740A00830 (Unity) GameObject_CUSTOM_GetComponentInChildren
    14. 0x000001AB121BFA27 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.GameObject:GetComponentInChildren (UnityEngine.GameObject,System.Type,bool)
    15. 0x000001AB121BF5CB (Mono JIT Code) UnityEngine.Component:GetComponentInChildren (System.Type,bool)
    16. 0x000001AB121BF43B (Mono JIT Code) UnityEngine.Component:GetComponentInChildren<T_REF> ()
    17. 0x000001AB121BD72B (Mono JIT Code) [C:\Dev\Unity\XX Our Project XX\Assets\Scripts\UI\TextTranslator.cs:35] TextTranslator:OnValidate ()
    18. 0x000001AB0C7ABBE8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    19. 0x00007FFBC4E7D6D0 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
    20. 0x00007FFBC4E02932 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2921] do_runtime_invoke
    21. 0x00007FFBC4E0B98F (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2968] mono_runtime_invoke
    22. 0x00007FF7408F527E (Unity) scripting_method_invoke
    23. 0x00007FF7408EF17D (Unity) ScriptingInvocation::Invoke
    24. 0x00007FF7408EF44E (Unity) ScriptingInvocation::InvokeChecked
    25. 0x00007FF740956AF6 (Unity) SerializableManagedRef::CallMethod
    26. 0x00007FF7408B9003 (Unity) MonoBehaviour::CheckConsistency
    27. 0x00007FF7408B7B74 (Unity) MonoBehaviour::AwakeAfterRestoreFromBackup
    28. 0x00007FF7409565F2 (Unity) SerializableManagedRefsUtilities::AwakeInstancesAfterBackupRestoration
    29. 0x00007FF7408BA5E3 (Unity) MonoManager::EndReloadAssembly
    30. 0x00007FF7408C09E7 (Unity) MonoManager::ReloadAssembly
    31. 0x00007FF73EC87173 (Unity) ReloadAllUsedAssemblies
    32. 0x00007FF73F1A6349 (Unity) ImportAndPostprocessOutOfDateAssets
    33. 0x00007FF73F1ADFEB (Unity) RefreshInternalV2
    34. 0x00007FF73F1B0C96 (Unity) StopAssetImportingV2
    35. 0x00007FF73F1A8146 (Unity) InitialScriptRefreshV2
    36. 0x00007FF73E6C2B98 (Unity) Application::InitializeProject
    37. 0x00007FF73F05F514 (Unity) WinMain
    38. 0x00007FF7420CE592 (Unity) __scrt_common_main_seh
    39. 0x00007FFC21CC7034 (KERNEL32) BaseThreadInitThunk
    40. 0x00007FFC2207D0D1 (ntdll) RtlUserThreadStart
    41.  
    42. ========== END OF STACKTRACE ===========
    43.  
    TextTranslator:OnValidate
    Code (CSharp):
    1.    
    2.     private void OnValidate()
    3.     {
    4.         if (text == null)
    5.             text = GetComponentInChildren<TMP_Text>();
    6.  
    7.         if (text != null)
    8.             text.text = translation.Text;
    9.     }
    10.  
    Thanks!
     
  8. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Hey could any fill out a bug report and give as much detail as possible? Its always easier to track a issue if we have a solid reproduction.
     
  9. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Based on the latest post from @starstablesimon, great find on your parts as confirming this indeed appears to be V2 related. We will need the folks responsible for the database at Unity to take a closer look at this.

    As such and as per @phil-Unity previous post, it would be great if you could submit a bug report with project for them to look at and to resolve this issue.
     
    Last edited: Feb 10, 2021
  10. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,307
    If I get some free time to submit reports I'll do so.
    I have LOTS of crash data very similar to this. Always from AssetDatabase V2 refresh
    and something usually related to "(mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\mini\aot-runtime.c:2507] mono_aot_get_cached_class_info"

    crashes.png
     
  11. Vitaly_Unity

    Vitaly_Unity

    Unity Technologies

    Joined:
    Sep 4, 2013
    Posts:
    21
    Hello
    I am QA from AssetPipeline team. We have tried to reproduce this crash with simple project with TMP and using OnValidate, but with no luck. Could you please add more info on your project/setup and any details on what you usually do when get the crash ? Of course the best would be to get the project where those crashes reproduce - then we in QA can play with it and try to get the crash.
    Thanks in advance!
     
  12. starstablesimon

    starstablesimon

    Joined:
    Nov 24, 2016
    Posts:
    18
    Hi! I started a conversation with you about sharing our project.
     
    phil-Unity likes this.
  13. Vitaly_Unity

    Vitaly_Unity

    Unity Technologies

    Joined:
    Sep 4, 2013
    Posts:
    21
    Awesome! Answered you in DM.
    Sorry, for some reason I didn't get any notifications and missed your message...
     
  14. Vitaly_Unity

    Vitaly_Unity

    Unity Technologies

    Joined:
    Sep 4, 2013
    Posts:
    21