Error "_createMenuRef called with existing principal MenuRef already associated with menu" in MonoMac project

615 views Asked by At

I have a MonoMac project that builds and runs fine. However it then crashes with the error

2015-10-11 14:27:08.656 AccessMac[1585:145835] _createMenuRef called with existing principal MenuRef already associated with menu
2015-10-11 14:27:08.657 AccessMac[1585:145835] (
    0   CoreFoundation                      0x94c01c63 __raiseError + 195
    1   libobjc.A.dylib                     0x9647fa2a objc_exception_throw + 276
    2   CoreFoundation                      0x94c01b7d +[NSException raise:format:] + 141
    3   AppKit                              0x98da65b3 -[NSCarbonMenuImpl _createMenuRef] + 70
    4   AppKit                              0x98da5d44 -[NSCarbonMenuImpl _instantiateCarbonMenu] + 155
    5   AppKit                              0x98da5c9e -[NSCarbonMenuImpl setupCarbonMenuBar] + 40
    6   AppKit                              0x98da41fd -[NSApplication finishLaunching] + 1398
    7   ???                                 0x1116f5d4 0x0 + 286717396
    8   ???                                 0x1116e418 0x0 + 286712856
    9   ???                                 0x000ee6e0 0x0 + 976608
    10  libmono-2.0.dylib                   0x0040e90f mono_jit_runtime_invoke + 751
    11  libmono-2.0.dylib                   0x005d0b0f mono_runtime_invoke + 127
    12  libmono-2.0.dylib                   0x005d103a mono_runtime_class_init_full + 778
    13  libmono-2.0.dylib                   0x0040b893 mono_jit_compile_method_with_opt + 4115
    14  libmono-2.0.dylib                   0x0040a829 mono_jit_compile_method + 57
    15  libmono-2.0.dylib                   0x004c0bf1 common_call_trampoline + 961
    16  libmono-2.0.dylib                   0x004c081c mono_magic_trampoline + 60
    17  ???                                 0x000ab088 0x0 + 700552

Does anyone know what could be causing this?

1

There are 1 answers

0
Igor On

Here is described an easy workaround on this:

https://github.com/mono/MonoGame/issues/3790#issuecomment-128841617

In short:

  • Create default MainMenu xib (New File -> MonoMac -> MainMenu)
  • Set this MainMenu as a main interface in Info.plist