NullReferenceException when instantiating an inheriting class

I write my own game engine in XNA and started porting it to MonoGame so that I can put it on Android / iOS / Windows 8. For some reason, I get an exception with a null reference when the main one creates a new game object. Thus, the code that allocates the object:

static void Main(string[] args) { //game g = new game(); using (game game = new game()) { game.Run(); } } 

and the error is

  public lesaEngine() 

which is the base constructor for the game object.

inheritance as always

  class lesaEngine : Microsoft.Xna.Framework.Game class game : lesaEngine 

Not sure what's going on here. It works fine with normal XNA. I am using Visual Studio 2012 for the port.

+4
source share
1 answer

Did you create a new Win8 monogame project? if so, the entry point should look more like

 #if !NETFX_CORE using (MyGame game = new MyGame()) { game.Run(); } #endif #if NETFX_CORE var factory = newMonoGame.Framework.GameFrameworkViewSource<MyGame>(); Windows.ApplicationModel.Core.CoreApplication.Run(factory); #endif } 
+1
source

All Articles