Issues with Jobs package 0.50/0.51 on Unity 2022

I moved a project with the latest Pathfinding package to Unity 2022 and also updated the Jobs package to the latest (0.51.0) and it reports errors in the console and will crash after a Domain Reload. It’s fine though if just using Jobs 0.11.0.

This appears to be related to this change in 0.50.0:

  • Job reflection data ILPP
  • IJob* types use SharedStatic so they can be burst compiled eventually
  • Early job initialization now happens during domain reload rather than delayed until EntityManager.Initialize

The errors in the console are:

Failed to create job reflection data for type $Pathfinding.Jobs.IJobTimeSliced:
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogError (object)
Unity.Jobs.EarlyInitHelpers:JobReflectionDataCreationFailed (System.Exception,System.Type) (at Library/PackageCache/com.unity.jobs@0.50.0-preview.8/Unity.Jobs/EarlyInitHelpers.cs:47)
__JobReflectionRegistrationOutput__2812101460:CreateJobReflectionData ()
__JobReflectionRegistrationOutput__2812101460:EarlyInit ()
System.Reflection.RuntimeMethodInfo:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
System.Reflection.MethodBase:Invoke (object,object[])
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes ()

(Filename: Library/PackageCache/com.unity.jobs@0.50.0-preview.8/Unity.Jobs/EarlyInitHelpers.cs Line: 47)

TypeLoadException: Invalid generic instantiation
  at Unity.Jobs.IJobExtensions.EarlyJobInit[T] () [0x00001] in <9d8790cb07b5448489717b720a1ca024>:0 
  at __JobReflectionRegistrationOutput__2812101460.CreateJobReflectionData () [0x003a0] in <2187e47e7673442ca506a915b212452b>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
Unity.Jobs.EarlyInitHelpers:JobReflectionDataCreationFailed(Exception, Type) (at Library\PackageCache\com.unity.jobs@0.50.0-preview.8\Unity.Jobs\EarlyInitHelpers.cs:48)
__JobReflectionRegistrationOutput__2812101460:CreateJobReflectionData()
__JobReflectionRegistrationOutput__2812101460:EarlyInit()
System.Reflection.RuntimeMethodInfo:InternalInvoke(RuntimeMethodInfo, Object, Object[], Exception&)
System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes()

And it’ll crash after causing it to reload the domain by changing code or similar.

1 Like