Description

Passing Menu object as a reference parameter is unsupported.

Workaround

Pass the Menu object by value or as read-only instead of by reference.  The reason is, when passing by value or as read-only, if you change the properties of the object by value or as read-only, you are changing the original object, which is the same as passing by reference.

2
1