StateMachineBehaviour.OnStateExit crashes Unity

Hi there,
I managed to crash unity from StateMachineBehaviour.OnStateExit call. Am I doing here something “illegal”? or it’s a bug?..
So, I have a very simple scene with a button and a panel (side by side). Clicking that button animates the panel’s scale.
I also have a state machine behaviour script on the animation’s state. Inside OnStateExit I want to disable the game object, so I call the following:

animator.gameObject.SetActive(false);

and bam - unity crashes…

See attached unitypackage for my test scene.

Any help on how to go about this and/or explanation on what’s going on would be very much appreciated.

2044405–132754–custombehaviour.unitypackage (13.5 KB)

This is a know bug which was fixed in 5.0.1 p1, it should be available to public in a few week

Thanks!