When developing for C# and using Windows Forms creating and using global objects is trivial:

public static class Program
{
  public static Foo MyFoo = new Foo();

  static void main()
  {
    Main = new MainForm(MyFoo);
  }
}

The same can’t be said for MonoMac. The mistake is to equate the static MainClass class as being the same as the WinForms Program class in the example shown.

The solution is to put the global class instantiation inside the NSApplication delegate. MonoMac creates this automatically and calls it AppDelegate. The above example becomes:

public partial class AppDelegate : NSApplicationDelegate
{
  MainWindowController mainWindowController;

  public Foo MyFoo = new Foo();

  public AppDelegate ()
  {
  }

  public override void FinishedLaunching (NSObject notification)
  {
    mainWindowController = new MainWindowController(MyFoo);
    mainWindowController.Window.MakeKeyAndOrderFront(this);
  }
}