CLR Interop Issues Across Tiers [AX 2012]
Updated: February 20, 2012
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
CLRObject instances cannot be passed between Microsoft Dynamics AX tiers.
An X++ method marked with the keyword server runs on the Application Object Server (AOS) tier. Your server method SS cannot return a .NET Framework object to another method CC that calls SS from the client tier.
The following X++ code example has a server method that is called by a client method. The server method returns a .NET Framework object of type System.String. However, .NET Framework objects cannot be serialized and de-serialized by Microsoft Dynamics AX. Therefore they cannot be returned to a caller that is running on a different tier (in this case, the client tier).
An attempt to run this code example causes an error message that states that the CLRObject is not initialized.
This code represents the server method that is called from the client.
Client Method, the Caller
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.