Andriod Studio Emulator on Windows Arrow Function in UseEffect Causes crash

I recently upgraded my app to Expo 41 from expo 38. At which point my code started throwing random errors on my Windows Andriod Studio emulator. It works fine on actual ios device, andriod device, ios emulator and andriod emulator on Mac.

I finally tracked down the issue to a return function on a useEffect

This no longer works with an arrow function:

useEffect(() => {
const unsubscribe = props.navigation.addListener(‘focus’, loadRoles);
return () => {
unsubscribe();
};
}, [loadRoles]);

but redefining it this way worked fine:

useEffect(() => {
const unsubscribe = props.navigation.addListener(‘focus’, loadRoles);
return function cleanup() {
unsubscribe();
};
}, [loadRoles]);

Does anyone know why?