I just installed xamarin and monogame on OSX I have tried to run a really basic demo project that works perfectly on windows. But I get the following error:
System.NullReferenceException: Object reference not set to an instance of an object
at Microsoft.Xna.Framework.OpenTKGameWindow.Initialize () [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.OpenTKGameWindow..ctor () [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.OpenTKGamePlatform..ctor (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.GamePlatform.Create (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.Game..ctor () [0x00000] in <filename unknown>:0
at test.Game1..ctor () [0x00057] in /Users/remojansen/Desktop/test/test/Game1.cs:37
at test.Program.Main () [0x00001] in /Users/remojansen/Desktop/test/test/Program.cs:19
There is nothing wrong about the code so I must be missing a DLL or something? Do you have any ideas about what could be missing?
Thanks :)
[EDIT]
The disassembly shows a error in the second line:
00000155 callvirt IWindowInfo OpenTK.NativeWindow:get_WindowInfo ()
0000015a ldnull
0000015b callvirt Object System.Reflection.PropertyInfo:GetValue (Object, Object[])
00000160 unbox.any System.IntPtr
00000165 stfld
0000016a call GraphicsMode OpenTK.Graphics.GraphicsMode:get_Default ()
0000016f ldarg.0
00000170 ldfld
00000175 callvirt IWindowInfo OpenTK.NativeWindow:get_WindowInfo ()
0000017a newobj Void OpenTK.Graphics.GraphicsContext:.ctor (GraphicsMode, IWindowInfo)
I have also manually compiled OpenTK and when I run the examples they seem to work fine:
I guess the problem is in monogame, I installed monogame using the xamarin monogame project template.