How to add an outgoing transition from the source state to the exit state by code?

AnimatorStateMachine.AddStateMachineExitTransition is use for state machine.

How to add an outgoing transition from the source state to the exit of it’s parent state machine?

I try to add a transition without destination state,

It looks fine at first

but if I close Unity and reopen the Project, the transition disappear

AnimatorState.AddExitTransition() solve my problem…