Greg On Dynamics Ax

Random thoughts about development using Dynamics AX and .Net

Solving an ‘Object object has not been initialized’ runtime error

leave a comment »

If you have received the error below, and are scratching your head over the cause:

Object object not initialised error

Then the answer is to check you have called super() in your constructor. The compilation output will also display a warning to that effect:

Compile warning for not overriding super in constructor

Related notes about extending Object and initialization

Unlike C#, Object is not implicitly extended when creating a new class. You’ll need to ensure that the ‘extends object’ class declaration is included if you want to call methods declared in Object, eg:

extendsObject

Repeating the aforementioned error (and also unlike C#) the base constructor is not implicitly called in X++:

void new()
{
;
super(); //base constructor is not called implicitly
}
About these ads

Written by gregondax

November 23, 2009 at 9:30 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: