Null reference on Game class instantiation on one caller but not the other caller.

I’ve got two programs that both call a class which has a base class of Microsoft.Xna.Framework.Game:

Example:

public class VOController : Microsoft.Xna.Framework.Game
{
public VOController( )
: base( ) // This is where it crashes with a NullExceptionReference
{
}
}

This works when called from one Visual Studio 2017 project (program) but crashes when used by the other project (program), both in the same Visual Studio 2017 solution.

At the moment, I don’t know why or what differences there would be in the two programs that would cause this same code to crash with null reference exception on one but not the other one.

Is there some other initialization required by MonoGame before instantiating the Game class?

What might cause a null reference exception in the Microsoft.Xna.Framework.Game constructor?

I’m on Windows 10, Visual Studio 2017, and MonoGame 3.6.

Thanks in advance for any help or ideas on this.

I’ve discovered this works fine with MonoGame 3.7 DEV.

What might cause it to crash on one program that uses this class but not on another in the 3.6 version but work fine with both of them on the 3.7 DEV version?

Reference MonoGame bug at https://github.com/MonoGame/MonoGame/issues/6169

1 Like