I am trying to access a OS X driver through a framework that I've written in MonoMac. In that process I thought it would be easier if I would stick to the Simple tutorial and make that work first before adding more complexity like dependencies on other dylibs. With some perseverance I managed to get Simple to Write "OK" to the console and I started to work to convert the driver Framework following the now familiar path I had followed by converting Simple.Framework to Simple.dll.
However this time whenever I was trying to create an instance of any class inside that Driver.Framework it would throw a NullPointerException. So I tried quite a few things until I started to narrow down what the real problem was by cutting off parts of that framework to see where the problem was. Even just using stubs it would crash. Then I wondered if my Simple.dll would still work and even that would crash in the same way. Then I created a new Test project and Simple.dll still didn't work. Then I didn't even include Simple.dll and just added the following line of code:
var test = new NSObject();
This should work, shouldn't it? But exactly same runtime error occurred:
System.NullReferenceException: Object reference not set to an instance of an object at MonoMac.ObjCRuntime.Class.Register (System.Type type) [0x00007] in /Users/builder/data/lanes/1248/f2847d5f/source/xamcore/maccore/src/ObjCRuntime/Class.cs:134 at MonoMac.ObjCRuntime.Class.GetHandle (System.Type type) [0x00002] in /Users/builder/data/lanes/1248/f2847d5f/source/xamcore/maccore/src/ObjCRuntime/Class.cs:103 at MonoMac.Foundation.NSObject.AllocIfNeeded () [0x0001e] in /Users/builder/data/lanes/1248/f2847d5f/source/xamcore/maccore/src/Foundation/NSObject2.cs:475 at MonoMac.Foundation.NSObject..ctor () [0x00008] in /Users/builder/data/lanes/1248/f2847d5f/source/xamcore/maccore/src/Foundation/NSObject2.cs:106 at Test2.MainClass.Main (System.String args) [0x00001] in /Users/Lucas/Code/Xamarin/Test2/Test2/Main.cs:16
So I am wondering if there might be some kind of mixup happening inside Xamarin because I first installed MacMono, then hand compiled MacMono to obtain bmac.exe to only upgrade in the end to Xamarin.Mac. Then I installed one or two upgrades when prompted, now running 5.8.3.
Who can shed some light on this?