Application Object reference not set to an instance of an object.

Jul 19, 2012 at 10:14 PM

The compiler keeps breaking on the line:

Application.Run<MyApplication>();

  Of the Main function of my Boot class.

 

I get the error "Object reference not set to an instance of an object." reffering to my MyApplication class.

 

However the application does run if I keep compiling. It happens fairly often though. Does anybody have any idea what this could be?

Jul 20, 2012 at 10:46 AM

Could you please share the code you have in your MyApplication constructor?

The Application.Run<T>() static method simply creates a new instance of T (in this case MyApplication) using the argument free constructor. So if an exception would occur, in your case a NullReferenceException, that means that you have something in the constructor that isn't initialized correctly.

Jul 20, 2012 at 1:04 PM

Ah ok that explains it then.

Actually I was initializing the IGP profiler here but I can just comment it until I need it.