Animator Crash when using PlayableGraph

I’ve been encountering a consistent crash issue when using PlayableGraph to control animations in my character. After extensive testing, I’ve managed to reproduce the crash consistently. Here is the test code that demonstrates the problem:

public class CrashLaunch : MonoBehaviour
{
    public Animator Animator;
    public RuntimeAnimatorController AnimatorController;

    private PlayableGraph mGraph;
    private AnimationMixerPlayable mMixer;

    private void Awake()
    {
        DoCrash();
    }

    private void OnDestroy()
    {
        if (mGraph.IsValid())
        {
            mGraph.Destroy();
        }
    }

    private void DoCrash()
    {
        mGraph = PlayableGraph.Create("CrashGraph");
        mGraph.SetTimeUpdateMode(DirectorUpdateMode.Manual);
        mMixer = AnimationMixerPlayable.Create(mGraph);
        var output = AnimationPlayableOutput.Create(mGraph, "output", Animator);
        output.SetSourcePlayable(mMixer);

        SetRuntimeAnimationController(Animator.runtimeAnimatorController);
        Animator.runtimeAnimatorController = null;
        SetRuntimeAnimationController(AnimatorController);

        mGraph.Play();

        Animator.SetFloat("CrashTrigger", 1);
    }

    private void SetRuntimeAnimationController(RuntimeAnimatorController controller)
    {
        var animatorPlayable = AnimatorControllerPlayable.Create(mGraph, controller);

        if (mMixer.GetInputCount() > 0)
        {
            Playable playable = mMixer.GetInput(0);
            mMixer.DisconnectInput(0);
            playable.Destroy();
            mMixer.ConnectInput(0, animatorPlayable, 0);
        }
        else
        {
            mMixer.AddInput(animatorPlayable, 0, 1);
        }
    }
}

The crash log shows the following call stack:

 Managed Stacktrace:
=================================================================
   at <unknown> <0xffffffff>
   at UnityEngine.Animator:SetFloatString <0x00168>
   at UnityEngine.Animator:SetFloat <0x000a2>
   at CrashLaunch:smile:oCrash <0x0055a>
   at CrashLaunch:Awake <0x00082>
   at System.Object:runtime_invoke_void__this__ <0x00187>
===============================================================
Received signal SIGSEGV
Obtained 33 stack frames
0x00007ff740b24a15 (Unity) Animator_CUSTOM_SetFloatString
0x00000203ffff7c89 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Animator:SetFloatString (UnityEngine.Animator,string,single)
0x00000203ffff7a83 (Mono JIT Code) UnityEngine.Animator:SetFloat (string,single)
0x00000203fffebe2b (Mono JIT Code) CrashLaunch:smile:oCrash () (at D:/UnityWorkspace/PlayableGraphCrash/Assets/CrashLaunch.cs:37)
0x00000203fffeb853 (Mono JIT Code) CrashLaunch:Awake () (at D:/UnityWorkspace/PlayableGraphCrash/Assets/CrashLaunch.cs:18)
0x0000020219ab3c58 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ff88b694bfe (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ff88b5cd254 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3068)
0x00007ff88b5cd3cc (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3115)
0x00007ff7418af514 (Unity) scripting_method_invoke
0x00007ff74188d274 (Unity) ScriptingInvocation::Invoke
0x00007ff74188d35e (Unity) ScriptingInvocation::InvokeChecked
0x00007ff74192fc26 (Unity) SerializableManagedRef::CallMethod
0x00007ff7418748fb (Unity) MonoBehaviour::CallAwake
0x00007ff741872d95 (Unity) MonoBehaviour::AddToManager
0x00007ff741873ada (Unity) MonoBehaviour::AwakeFromLoad
0x00007ff741971e0d (Unity) AwakeFromLoadQueue::InvokePersistentManagerAwake
0x00007ff741972de1 (Unity) AwakeFromLoadQueue::PersistentManagerSingleQueueAwakeFromLoad
0x00007ff741972a50 (Unity) AwakeFromLoadQueue::PersistentManagerAwakeFromLoad_NoChecks
0x00007ff74156e825 (Unity) LoadSceneOperation::CompleteAwakeSequence
0x00007ff74156f3a0 (Unity) LoadSceneOperation::CompletePreloadManagerLoadSceneEditor
0x00007ff74157008e (Unity) LoadSceneOperation::IntegrateMainThread
0x00007ff7415736ae (Unity) PreloadManager::UpdatePreloadingSingleStep
0x00007ff741573dcf (Unity) PreloadManager::WaitForAllAsyncOperationsToComplete
0x00007ff7427f0a72 (Unity) EditorSceneManager::RestoreSceneBackups
0x00007ff7424eb4f6 (Unity) PlayerLoopController::EnterPlayMode
0x00007ff7424fbcb6 (Unity) PlayerLoopController::SetIsPlaying
0x00007ff7424ff3b0 (Unity) Application::TickTimer
0x00007ff74297977a (Unity) MainMessageLoop
0x00007ff74297e650 (Unity) WinMain
0x00007ff743d5e0ae (Unity) __scrt_common_main_seh
0x00007ff8fb777344 (KERNEL32) BaseThreadInitThunk
0x00007ff8fc3626b1 (ntdll) RtlUserThreadStart

The submitted attachment is a project that crashes when the SampleScene is run.

9771873–1400439–PlayableGraphCrash.7z (43.8 KB)

Report a bug via the Help menu.

Thanks, I have already reported.