Enable / Disable Menu Item causing IllegalCastException on Linux

I have a Help menu item that should only be enabled if a boolean flag is set true. This works properly on macOS, but on Linux I get an IllegalCastException on this line in the window’s EnableMenuItems event:

HelpEnableLTFSTools.Enabled = LTFSInstalled

I have verified that the HelpEnableLTFSTool menu item exists and that LTFSInstalled exists, is a Boolean, and is “True” at that point.

I don’t see how that simple line of code could be an issue. Anyone have an idea?

2019r3.2 and 2021r1.1

The actual error is:

MenuItem cannot be cast to ApplicationMenuItem

However, it’s under the HelpMenuItem and the super is MenuItem as seen in the screenshot above.

I think the error says you need to set the Super to ApplicationMenuItem instead of MenuItem. But I may be wrong.

Thanks Emile. That wasn’t it and I’ll probably never know the true cause. I deleted that menu and then recreated it and the problem has gone away.

1 Like