Full CIL Generation from X++ in AX 2012

What is CIL?

CIL stands for Common Intermediate Language and it works together with the CLI or Common Language Infrastructure, which is basically a set of rules on programming languages that will compile with the CIL. 
CIL (Common Intermediate Language), formerly known as MSIL (Microsoft Intermediate Language) or sometimes simply IL is a low-level language used by .NET Framework.

The runtime (CLR) doesn’t work directly with high-level languages like C#, it works with CIL and compilers of high-level languages simply generate CIL. The runtime handles CIL in the same way regardless it was generated from C#, Visual Basic, Iron Python… or from X++.

We have two types of CIL compilations, the incremental CIL and the full CIL compilation. The major difference between the two of them is that the incremental CIL would compile only the objects that were modified since the last incremental compilation.

Compile: -The compile is to convert x++ source code into p-code.

Synchronization: - Checking each and every table defining the value of your EDT

Full CIL :- generate CIL is about to convert the p-code into CIL, referred to as the byte code which, at run time, is used by the CLR to convert into native code for execution on the computer. It is easier to understand that a full CIL generation involves converting all p-code into CIL, finally it converts to the binary Language.

Incremental CIL: - incremental CIL generation involves only the “changed” p-code artefacts that need to be converted into target CIL. Incremental CIL would compile only the objects that were modified since the last incremental compilation.

Some X++ batch jobs can now complete in much less time. All X++ code that runs on the AX32.exe client still runs as interpreted p-code. However, all batch jobs now run as Microsoft .NET Framework CIL, which is often much faster than p-code.
This post describes one of the many strange errors which might occur if the CIL Generation was not done properly.  If you want to know more about CIL generation. Go here: X++ compiled to .Net CIL [Ax2012]
In Microsoft Dynamics AX, scheduled batch jobs written in X++ must first be compiled into the common intermediate language (CIL) of the .NET Framework.

I faced this one issue when I was trying to do a Full CIL Generation after fixing an Over-layering.
Error message was “Type name does not exist.

The VendRequestAuditContract.getAttribute () reflection API could not create and return the AifCollectionTypeAttribute object. Please check the parameters.”

Before looking into more details, I followed the below best practises suggested when working with CIL generation.
  1. Stop AOS.
  2. Delete all files from path C:\Program Files\Microsoft Dynamics AX\60\Server\<<Instance name>>\bin\XppIL.
  3. Start AOS.
  4. AOT > Add-ins > Incremental CIL generation from X++ And that solves the problem. Takes some time in CIL generation but is always effective.

Related Posts

Previous
Next Post »

Thanks for comments.....