web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

DAX Development: Compile, Generate (CIL), and Restart (AOS)

(0) ShareShare
ReportReport
Posted on by

In AX development, it is a bit confusing about the real meaning of “compile”,  “generate full CIL or incremental CIL”, and in which cases need to restart AOS instance(s), but I believe it is import to make clear about it.

To compile is to convert x++ source code into p-code, while to generate CIL is about to convert the p-code into CIL – the common intermediate language, 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 whereas an incremental CIL generation involves only the “changed” p-code artifacts that need  to be converted into target CIL.

Even CIL generation involves the model store update in the database, a critical observation is that it updates .dll files in the XppIL folder under the AOS installation folders. In other words, it updates the assemblies used by the AOS service. This is an implication for restarting  the AOS.  Note, usually we don’t need to restart the AOS due to the CIL generation is through the AOS instance, i.e. the AOS instance is automatically "reloaded" the newly generated assemblies. And this is why when we use load balance, we need to restart all AOS instances other than the one with that we generate the CIL.

The X++ compiler is triggered automatically when we save source code. It does the syntax check and p-code generation from the source code. But CIL generation is not automatic, neither AOS to restart, when needed.

One might wonder why not a single step to compile x++ source code into CIL, but rather through p-code? In fact, the system keeps p-code and CIL for the same objects, and these objects can run through both CLR and p-x++ interpreter respectively. I believe it is a historical reason – the early product has nothing to do with .Net platform, but now it evolves into that direction.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    my study notes. your comments and corrections are greatly appreciated.

  • Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at

    You can compile X++ to p-code for an individual method but you can generate CIL for the whole type only, so you can't do it (reliable) in a single step. Also, if you compiled even a single method, you would still have to replace the whole assembly module, containing several other types.

    The solution would be having a X++ compiler to CIL (as you have for C#, for example), but what AX does is that it dumps p-code to XML, reads through it and builds CIL types according the XML definition.

  • Verified answer
    Tommy Skaue Profile Picture
    Moderator on at

    I remember watching how Peter Villadsen explains how they were implementing support for CIL step-by-step at Channel9:

    channel9.msdn.com/.../peter-villadsen-and-gustavo-plancarte-inside-ax-translator-x-to-msil

    It is a journey, and there are still improvements to be made. :-)

  • Community Member Profile Picture
    on at

    and, lets not leave out the synchronizing the database. Basically, synchronization of the database is needed after import the model store. it commits database changes according to the new model store. In other words, it is to make the database schema and index identical to that defined in the AOT. I'd like to find out things around it in another topic.

  • Community Member Profile Picture
    on at

    Thanks Tommy for sharing the video, it is very insightful. Martin, now I understood that the p-code is translated into IL through xml. it can also be converted in say, C#.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans