Reputation: 5623
I am receiving a message in my custom project within AX 2009 when calling a method from a referenced dll I created. The message is Error executing code object not initialized. I have my project compiled successfully and the dll is referenced in the AOT.
The error occurs in MyClassExecuteCopy.copy() when trying to perform hostServices.Copy()
Can anyone see any issues as to why I would be receiving this message?
I shortened the code for this example as follows:
//classDeclaration
class MyClassExecute extends RunbaseBatch
{
MyDll.Win.HostServices hostServices;
MyDll.Data.InputParameters inputParams;
MyDll.Test.Data.ResultSummary resultSummary;
}
//MyClassExecute.initLiabraries
public void initLiabraries()
{
;
new InteropPermission(InteropKind::ClrInterop).assert();
hostServices = new MyDll.Win.HostServices();
inputParams = new MyDll.Data.InputParameters();
CodeAccessPermission::revertAssert();
}
////////////////////////////////////////////
class MyClassExecuteCopy extends MyClassExecute
{
}
//MyClassExecuteCopy.copy - Exception occurs on resultSummary line with "Error executing code: copySomething object not initialized"
void copy()
{
new InteropPermission(InteropKind::ClrInterop).assert();
//Exception occurs when executing line below with "Error executing code: copySomething object not initialized"
resultSummary = hostServices.Copy();
CodeAccessPermission::revertAssert();
}
//////////////////////////////////////////////
class CreateCopy extends Runbase
{
}
//CreateCopy.copySomething
public client server static void copySomething()
{
MyClassExecuteCopy myClassExecuteCopy;
;
new InteropPermission(InteropKind::ClrInterop).assert();
myClassExecuteCopy.initLiabraries();
myClassExecuteCopy.copy();
CodeAccessPermission::revertAssert();
}
Upvotes: 2
Views: 6979
Reputation: 5623
Found the issue to be initialized by data.
As a result hostServices.Copy() did not have the correct values and either resulting in an error within the dll or returned nothing either way was the result of the error message i was receiving within AX.
After correcting the data that same call processed as expected.
Upvotes: 1