Yes, this is a problem in VS2012 and up. This is caused by the C++11 language standard adopting the enum class
syntax. The C++/CLI compiler can now no longer distinguish a managed enum type from an unmanaged one. The cast from Object^ is only valid for a managed enum.
The workaround is silly but effective, you should explicitly specify the accessibility of the enum class. Something that's not legal in C++11 but valid in C++/CLI. Fix:
private enum class EMyEnum // Note: added private
{
Unknown,
NotBetter,
};
Or use public.