- Introduction (what Is CIL?)
CIL, formally known as MSIL (Microsoft Intermediate Language)
CIL, stands for Common Intermediate Language and it works together with the CLI or Common Language Infrastructures, which is basically a set of rules on programming languages that will compile with the CIL.
This is the way of convert source code to byte code. These steps divided into three level.
- Compilation (source code)
- CIL (P-code)
- CLR (Byte code)
2.Types of CIL
There are two types of CIL, Incremental CIL & Full CIL
- Incremental CIL:
Increment CIL would compile only the objects that were modified since the last incremental compilation.
Incremental CIL generation involves only the “changed” p-code artifacts that need to be converted into target CIL.
- Full CIL:
Full compile would compile wholes objects. Convert p-code into CIL referred as byte code at run time. Full CIL generation is mandatory when we do modify anything on the XppIL folder.
The CLR can execute code faster than the AX-Kernel version in the following cases.
- Computationally intensive code that does not a lot of data access.
- Memory intensive code(objects stored in memory)
4.Limitations of CIL
- CIL session does not have access to all the system classes.
- Only classes, tables, base enum are eligible for CIL .queries and forms are not applicable for CIL.
- Runbuff () and evalbuff () method code are not coming in CIL.
- This is always server side code.
5.Some basic error related to CIL
- Metadata exception
- The CIL Generator found errors and could not save the new assembly:
- The given key was not present in the dictionary.
- Source array was not long enough.
- A parameter could not be serialized.
- metadata contains data of other data like author ,data created and data modified some time these data were missing or not updated
Then this error comes. This is solved by full CIL
- This is because assembly issue just follow these steps.
Delete xppil files except folders
Do full compile
- Restart the server.
If error still coming then cleared cashes and delete AUC files
Error still coming cleared xppil files.
- Same xppil clear process if errors are still there and you have no error when compile X++, just comment the code notice in Compiler output with /*..*/, recompile CIL and delete comment tag
- For a quick resolve: uncheck option “Execute business operations in CIL” under Tools-> Options -> Development tab.
The reason is that you haven’t been able to do a successful FULL CIL compile, Run again and try to fix the error in CIL.
- Correct order for CIL
Compile, CIL (Incremental & Full CIL), Synchronize or Compile, Synchronize, CIL (Incremental & Full CIL)
CIL generation and DB synchronization are not related at all, therefore their order doesn’t matter.
CIL must be run after X++ compilation, because it depends on information provided by X++ compiler.
- What is xppIL folder?
XppIL Folder contains source code (.xpp extension) metadata & compiled code.
Source code are used to debug CIL code in Visual Studio when working with services and batches. In xppIL folder there are some bunch of files. These files are Net Module type files and they only contain type metadata and compiled code. The compilation creates an assembly (dynamic.ax.application.dll) on the other hand Net Module contains .net assemblies ( dynamic.ax.application.dll.netmodule)
Path for find xppIL folder: C:\Program Files\Microsoft Dynamics AX\60\Server\Server name \bin\XppIL
- How to CIL by x++
We can run x++ code as CIL by using this method: