.NET Proxy class error

Hello,

I’m trying to develop my first integration code between .NET and AX, using proxy classes.

I’m using the virtual machine with AX 2012 downloaded from the MS site.

I followed the example in the AX developer manual.

The problem is on the first call to a proxy class:

CustTable custTable = new CustTable();

On AX generated code it throws an Exception at this line:

[SuppressMessage(“Microsoft.Design”, “CA1062:ValidateArgumentsOfPublicMethods”)]
protected Common(Microsoft.Dynamics.AX.ManagedInterop.XppArtifactName tableName) :
base(tableName) {
}

At first the program generated this error:

"Could not load file or assembly ‘Microsoft.Dynamics.Ax.Xpp.Support, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.":“Microsoft.Dynamics.Ax.Xpp.Support, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”}

So I placed the Microsoft.Dynamics.Ax.Xpp.Support dll on the release folder.

The error changed but still happens at the same place:

{“The type initializer for ‘Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper’ threw an exception.”}

Any clue?

Thank you,

Ivan

Hello,

I found the solution … actually it was pretty simple, I forgot to logon to AX!

The error description actually is really bad …

Anyway, in this way it works:

using (Session session = new Session())

{

session.Logon(null, null, null, null);

var c = new IntegrazioneDAXLibrary4.CustomerExtended();

var paymentMode = c.GetCustomerPaymentMode(“1”, “ced”);

}

Hi

  1. Craeted class library called TestLibrary->Added to AOT->Build

  2. Created New Dynamics AX EP Web Application-> TestProject->Added the reference TestLibrary.DLL

Am able to write Using TestLibrary as intellisense but it shows some compilation error as

The type or namespace name ‘TestLibrary’ could not be found (are you missing a using directive or an assembly reference?)

One thing In TestLibrary Project i didn’t find any option called Deploy to EP to set YES.

Default namespace i kept as TestLibrary instead of Microsoft.Dynamics.Portal.Application.Proxy

Target framework .NET Framework 3.5 Platform Target Any CPU

Please suggest me what to do !