Random Crash on TMPro_UGUI_Private.OnValidate

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

========== OUTPUTTING STACK TRACE ==================

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 ()
0x000002C12E89C260 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFA8302D8C0 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
0x00007FFA82FB2912 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2921] do_runtime_invoke
0x00007FFA82FBB96F (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2968] mono_runtime_invoke
0x00007FF6EA39FCD4 (Unity) scripting_method_invoke
0x00007FF6EA3997FB (Unity) ScriptingInvocation::Invoke
0x00007FF6EA399ABE (Unity) ScriptingInvocation::InvokeChecked
0x00007FF6EA409093 (Unity) SerializableManagedRef::CallMethod
0x00007FF6EA362D00 (Unity) MonoBehaviour::CheckConsistency
0x00007FF6EA361724 (Unity) MonoBehaviour::AwakeAfterRestoreFromBackup
0x00007FF6EA408AE2 (Unity) SerializableManagedRefsUtilities::AwakeInstancesAfterBackupRestoration
0x00007FF6EA3643CD (Unity) MonoManager::EndReloadAssembly
0x00007FF6EA36AA39 (Unity) MonoManager::ReloadAssembly
0x00007FF6EB5003E3 (Unity) ReloadAllUsedAssemblies
0x00007FF6EAF9A3AC (Unity) Application::TickTimer
0x00007FF6EB79BAE4 (Unity) MainMessageLoop
0x00007FF6EB7A4E7E (Unity) WinMain
0x00007FF6ED420916 (Unity) __scrt_common_main_seh
0x00007FFAE9576FD4 (KERNEL32) BaseThreadInitThunk
0x00007FFAEB41CEC1 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========

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

5 mins after position and another crash (unrelated to TMP)

========== OUTPUTTING STACK TRACE ==================

0x00007FF6EA3C5F37 (Unity) TransferField_NonArray<StreamedBinaryWrite,Converter_SimpleNativeClass<RectOffset> >
0x00007FF6EA3EA0EB (Unity) Transfer_SimpleNativeClass<StreamedBinaryWrite,RectOffset,0>
0x00007FF6E8E278FB (Unity) ExecuteSerializationCommands<ConfigSettingsRead>
0x00007FF6E9EF032C (Unity) TransferScriptingObject<StreamedBinaryWrite,1>
0x00007FF6E9F0225D (Unity) SerializableManagedRefBackupGenerator::ExtractBackupFromInstance
0x00007FF6EA361AF8 (Unity) MonoBehaviour::BackupAndDeflateManagedReferences
0x00007FF6EA408D43 (Unity) SerializableManagedRefsUtilities::BackupAndDeflateAll
0x00007FF6EA3620C2 (Unity) MonoManager::BeginReloadAssembly
0x00007FF6EA36A945 (Unity) MonoManager::ReloadAssembly
0x00007FF6EB5003E3 (Unity) ReloadAllUsedAssemblies
0x00007FF6EAF9A3AC (Unity) Application::TickTimer
0x00007FF6EB79BAE4 (Unity) MainMessageLoop
0x00007FF6EB7A4E7E (Unity) WinMain
0x00007FF6ED420916 (Unity) __scrt_common_main_seh
0x00007FFAE9576FD4 (KERNEL32) BaseThreadInitThunk
0x00007FFAEB41CEC1 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========

Seriously Unity, you're killing me

Is this in a build?

No in Editor

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.

What version of the TMP package are you using?

Do you also have a call stack?

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,

========== OUTPUTTING STACK TRACE ==================

0x00007FFBC4F48E35 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\mini\aot-runtime.c:2507] mono_aot_get_cached_class_info
0x00007FFBC4D8BD50 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\class.c:5039] mono_class_init
0x00007FFBC4D8CB62 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\class.c:8173] mono_class_is_subclass_of
0x00007FF7408F3A50 (Unity) scripting_class_has_parent
0x00007FF7408DE2CF (Unity) ComponentMatchesRequirement_ByScriptingClassNoInterface
0x00007FF7408DB450 (Unity) GetComponentsImplementation<1,1>
0x00007FF7408DBBDC (Unity) GetComponentsImplementationRecurse<1,0,1>
0x00007FF7408DCBF0 (Unity) GetComponentsOfTypeFromGameObject<1,0>
0x00007FF7408DFD41 (Unity) ScriptingGetComponentsOfTypeFromGameObject
0x00007FF740A00830 (Unity) GameObject_CUSTOM_GetComponentInChildren
0x000001AB121BFA27 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.GameObject:GetComponentInChildren (UnityEngine.GameObject,System.Type,bool)
0x000001AB121BF5CB (Mono JIT Code) UnityEngine.Component:GetComponentInChildren (System.Type,bool)
0x000001AB121BF43B (Mono JIT Code) UnityEngine.Component:GetComponentInChildren<T_REF> ()
0x000001AB121BD72B (Mono JIT Code) [C:\Dev\Unity\XX Our Project XX\Assets\Scripts\UI\TextTranslator.cs:35] TextTranslator:OnValidate ()
0x000001AB0C7ABBE8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFBC4E7D6D0 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
0x00007FFBC4E02932 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2921] do_runtime_invoke
0x00007FFBC4E0B98F (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2968] mono_runtime_invoke
0x00007FF7408F527E (Unity) scripting_method_invoke
0x00007FF7408EF17D (Unity) ScriptingInvocation::Invoke
0x00007FF7408EF44E (Unity) ScriptingInvocation::InvokeChecked
0x00007FF740956AF6 (Unity) SerializableManagedRef::CallMethod
0x00007FF7408B9003 (Unity) MonoBehaviour::CheckConsistency
0x00007FF7408B7B74 (Unity) MonoBehaviour::AwakeAfterRestoreFromBackup
0x00007FF7409565F2 (Unity) SerializableManagedRefsUtilities::AwakeInstancesAfterBackupRestoration
0x00007FF7408BA5E3 (Unity) MonoManager::EndReloadAssembly
0x00007FF7408C09E7 (Unity) MonoManager::ReloadAssembly
0x00007FF73EC87173 (Unity) ReloadAllUsedAssemblies
0x00007FF73F1A6349 (Unity) ImportAndPostprocessOutOfDateAssets
0x00007FF73F1ADFEB (Unity) RefreshInternalV2
0x00007FF73F1B0C96 (Unity) StopAssetImportingV2
0x00007FF73F1A8146 (Unity) InitialScriptRefreshV2
0x00007FF73E6C2B98 (Unity) Application::InitializeProject
0x00007FF73F05F514 (Unity) WinMain
0x00007FF7420CE592 (Unity) __scrt_common_main_seh
0x00007FFC21CC7034 (KERNEL32) BaseThreadInitThunk
0x00007FFC2207D0D1 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========

TextTranslator:OnValidate

    private void OnValidate()
    {
        if (text == null)
            text = GetComponentInChildren<TMP_Text>();

        if (text != null)
            text.text = translation.Text;
    }

Thanks!

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.

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.

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”

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!

Hi! I started a conversation with you about sharing our project.

1 Like

Awesome! Answered you in DM.
Sorry, for some reason I didn’t get any notifications and missed your message…

Looks like most of the crashes you experience were connected to this issue -
https://issuetracker.unity3d.com/is…o-when-gizmosetup-has-cached-an-outdated-data
The fix is in 2019.4.21f1.
Thanks to @starstablesimon for noticing this!!!