SlideShare una empresa de Scribd logo
1 de 25
Fabio Filardi
Dynamics AX Technical Architect
ffilardi@msbsgroup.com
X++ Compiled to .NET CIL


                           Overview


                           Lesson 1: Generating CIL


                           Lesson 2: How Process Works


                           Lesson 3: Debugging CIL Code


                           Lesson 4: Scenarios Not supported


                           Lab: Code Sample
Overview



  Why Is X++ Compiled to CIL?

 The CLR can execute code faster than the AX kernel in the following cases:

     1.   Computationally intensive code that does not do a lot of database access

     2.   Memory intensive code where lots of object are built and stored in
          memory
Overview



  In Microsoft Dynamics AX 2012 X++ batch jobs, service classes, and code
   executed on the AOS calling the RunAs API are compiled into the common
   intermediate language (CIL or simply IL) of the .NET framework.

  You can run your X++ code as CIL by using the method
   Global::runClassMethodIL.

  Using "server" modifier in your methods or setting RunOn Server parameter
   won't make it run as IL necessarily.

  The compilation creates an assembly called Dynamics.Ax.Application.dll which
   is stored on each AOS in the C:Program FilesMicrosoft Dynamics
   AX60ServerMicrosoftDynamicsAXbinXppIL folder.

  The .NET CLR executes the code rather than the AX kernel.
Overview


           RPC        Services




  AOS
                                 •   RunAs()
                                 •   Batch Jobs
                                 •   Services




                 DB
Lesson 1: Generating CIL
This lesson outlines the steps to turn X++ code into generated CIL code



    CIL Generation Steps

        Step                                         Description

        1. Write, save and compile your X++ class.   The X++ source code for your class is automatically
                                                     compiled into p-code when you save your source in
                                                     the AOT.

        2. Compile the p-code into CIL               X++ is compiled into .NET CIL code.
        3. Restart your multiple AOS services.       If your installation has more than one AOS, you
                                                     need to restart every AOS service after the CIL build
                                                     completes. The recycle causes each AOS to load the
                                                     assembly that contains the updated CIL.

        4. Call the class.                           Schedule the batch job that executes your class or
                                                     call the service class.
Lesson 1: Generating CIL
This lesson outlines the steps to turn X++ code into generated CIL code



    CIL Compilation Options

   For step #2 on the previous slide, Compile the p-code into CIL, two options are
   available:

        1. Generate Full CIL
              This option goes through the AOT and generates the CIL for all the modified
              objects that will be used in batch processes or as service classes.

        2. Generate Incremental CIL
              This option causes the CIL to be generated for all objects that have been modified
              since the last time the assembly was generated.
Lesson 1: Generating CIL
This lesson outlines the steps to turn X++ code into generated CIL code



    Generating CIL Code in the Developer Workspace

       Right-click the AOT node of the AOT, and
       navigate to the Add-Ins menu. The last two
       options on the menu will allow you to select the
       desired CIL option:




       You can also use the Build menu:
Lesson 1: Generating CIL
This lesson outlines the steps to turn X++ code into generated CIL code



    Generating CIL Code in the Application Workspace

   As the Administrator navigate to the System administration menu in Microsoft
   Dynamics AX, and then under Periodic, choose ‘Compile into .NET Framework
   CIL’:




   Important: This does a Full CIL generation.
Lesson 1: Generating CIL
This lesson outlines the steps to turn X++ code into generated CIL code



    Restart AOS Instances

   Step #3 in the CIL Generation Process is restart your multiple AOS services.

   After the assembly containing the CIL code has been created, the AOS used for
   the CIL generation has the current version of the assembly. However, other AOS
   have outdated code. To resolve this, the other AOS have to be restarted.
Lesson 2: How Process Works
This lesson explains the process to compile and execute CIL code



    Create and compile

   Objects created in Microsoft Dynamics AX 2012 are stored in the "metadata
   store". In prior versions of Microsoft Dynamics AX, this information was stored in
   the *.AOD files. In Microsoft Dynamics AX 2012, the metadata store has been
   moved into SQL Server.

   X++ compiler examines the object information in the metadata store and
   generates the p-code for that object. When the object is needed, the p-code is
   then executed by the X++ interpreter.

   When the CIL generation is done, the Microsoft Dynamics AX generates an XML
   file that contains a representation of the code based on the metadata for the
   object, and the p-code that exists for that same object. The IL generator will
   generate an assembly and a *.PDB file from the XML.
Lesson 2: How Process Works
This lesson explains the process to compile and execute CIL code



    CIL Generation



               X++


                           PCode




                                                                         .




                                                                   PDB




                                                                   DLL
Lesson 2: How Process Works
This lesson explains the process to compile and execute CIL code



    Netmodules and FileSystem

   If a single class changes, only the module that contains it needs to change while
   all the other types remain untouched.

   Microsoft Dynamics AX 2012 uses an algorithm that is based on the object type
   that is used to determine the ID number value for each netmodule.

   In the file system, the assembly will be represented as one dll file and thousands
   of netmodules files:
Lesson 2: How Process Works
This lesson explains the process to compile and execute CIL code



    Moving Databases between Environments

   The assembly containing the CIL code is stored in the database, and the version
   of the assembly in the database will be restored to the system if the database and
   file system versions are different.

   This is an attention point when updating the development environment with
   another database, like client production/homolog database.
Lesson 3: Debugging CIL Code
This lesson explains how to debug the .NET CIL code created by Dynamics AX



   Requirements for Debugging

   To debug CIL code the AOS must have Debugging enabled via the Server
    configuration utility.

        If debugging on the AOS is not enabled, the source for the X++ code that will be
        displayed in the debugger is not available, and an error is displayed in Visual Studio
        when you attempt to view the X++ source code for an object.

   Visual Studio 2010 (VS) must be installed on the AOS.

        To debug CIL code you have to attach to the AX32Serv.exe process in Visual Studio.
        This is not possible if Visual Studio is not installed on the AOS.
Lesson 3: Debugging CIL Code
This lesson explains how to debug the .NET CIL code created by Dynamics AX



   How to Debug CIL Code

  1.    On the AOS in VS click Tools, and then click Attach to Process.
  2.    In the form that opens mark the checkboxes for Show processes from all
        users and Show processes in all sessions.
  3.    Select AX32Serv.exe.
  4.    Click Attach.
  5.    In VS open the Application Explorer and locate the class or method you want
        to debug. The Application Explorer is simply a read only representation of the
        AOT, you navigate as you would the AOT in Microsoft Dynamics AX.
  6.    Set a breakpoint in the method.
  7.    Execute the batch process or call the service class.

  When the execution arrives at the breakpoint, the Visual Studio debugger
  provides all the functionality that it does for all other .NET languages.
Lesson 3: Debugging CIL Code
This lesson explains how to debug the .NET CIL code created by Dynamics AX



   VS Attach to Process - Screen Example
Lesson 3: Debugging CIL Code
This lesson explains how to debug the .NET CIL code created by Dynamics AX



   VS Debugging AX Class - Screen Example
Lesson 4: Scenarios Not Supported
This lesson explains where we can't use CIL code



    Scenarios not supported and restrictions
    Functions

              There are two X++ functions not supported in CIL: evalbuf and runbuf.

    Incremental CIL Generation Restriction

            Remove a method: a full generation of CIL for the class is necessary to remove
   the method from the existing CIL.

    Compile outcome when a class has one bad method

             The X++ compiler still generates valid p-code for methods that contain no errors,
   even after another method on the same class has been failed to compile. But when a full
   compile of X++ p-code to CIL is performed, the entire compile fails if valid p-code is
   unavailable for any method on any class.

             Until your system has a successful full CIL compile, your system cannot run
   services, SSRS reports, or batch jobs.
Lesson 4: Scenarios Not Supported
This lesson explains where we can't use CIL code



    Methods on Queries and Forms

   Class and tables are types in the X++ language. They can be compiled to CIL.

   The queries and forms in the AOT are not X++ types, and they cannot be
   compiled to CIL.

   This means there are a few minor cases where calls from CIL to X++ p-code can
   cause an exception. The problem is that the CIL session does not have access to
   all the system classes.
Lab: Code Sample
This lab shows two samples to illustrate CIL vs Pcode execution



   In this example we will use a simple condition to check if the active session is a CLR
   Session or not, called direct and by runClassMethodIL.

   1. Create a class with main() and an additional method:




   2. Generate Incremental CIL, and execute the class. Result:
Lab: Code Sample
This lab shows two samples to illustrate CIL vs Pcode execution



   In this example we will use a counter to show that the CIL run completed much faster than
   the interpreted run.

   1. First, create a class (named DemoClassCIL) with main() and 3 additional methods:
Lab: Code Sample
This lab shows two samples to illustrate CIL vs Pcode execution
Lab: Code Sample
This lab shows two examples to illustrate CIL vs Pcode execution



   Generate Incremental IL and execute the class. The result is something like below:




   As seen above, the result in this example was about 40x faster when executed in CIL.
X++ Compiled to .NET CIL




             That s all, thanks.

Más contenido relacionado

La actualidad más candente

Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3Ali Raza Zaidi
 
Ax 2012 x++ code best practices
Ax 2012 x++ code best practicesAx 2012 x++ code best practices
Ax 2012 x++ code best practicesSaboor Ahmed
 
Dynamics ax 2012 development overview
Dynamics ax 2012 development overviewDynamics ax 2012 development overview
Dynamics ax 2012 development overviewAli Raza Zaidi
 
Dynamics AX 2009 Data Dictionary - Güven Şahin - 04.05.2013
Dynamics AX 2009 Data Dictionary - Güven Şahin - 04.05.2013Dynamics AX 2009 Data Dictionary - Güven Şahin - 04.05.2013
Dynamics AX 2009 Data Dictionary - Güven Şahin - 04.05.2013guvensahin
 
X++ advanced course
X++ advanced courseX++ advanced course
X++ advanced courseAlvin You
 
ALV with Integrated Data Access
ALV with Integrated Data AccessALV with Integrated Data Access
ALV with Integrated Data AccessRadosław Gref
 
AX 2012 R3 Installation Guide
AX 2012 R3 Installation GuideAX 2012 R3 Installation Guide
AX 2012 R3 Installation GuideBiswanath Dey
 
Retail pos technical reference
Retail pos technical referenceRetail pos technical reference
Retail pos technical referenceAhmed Farag
 
Oracle XML Publisher / BI Publisher
Oracle XML Publisher / BI PublisherOracle XML Publisher / BI Publisher
Oracle XML Publisher / BI PublisherEdi Yanto
 
Chapter 02 sap script forms
Chapter 02 sap script formsChapter 02 sap script forms
Chapter 02 sap script formsKranthi Kumar
 
Oracle BI Publsiher Using Data Template
Oracle BI Publsiher Using Data TemplateOracle BI Publsiher Using Data Template
Oracle BI Publsiher Using Data TemplateEdi Yanto
 
Dynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay SharmaDynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay SharmaVijay Sharma
 
Integration with dynamics ax 2012
Integration with dynamics ax 2012Integration with dynamics ax 2012
Integration with dynamics ax 2012Ali Raza Zaidi
 
Job Control Language
Job Control LanguageJob Control Language
Job Control Languagekapa rohit
 
Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basicsvamshimahi
 

La actualidad más candente (20)

Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3
 
Ax 2012 x++ code best practices
Ax 2012 x++ code best practicesAx 2012 x++ code best practices
Ax 2012 x++ code best practices
 
Dynamics ax 2012 development overview
Dynamics ax 2012 development overviewDynamics ax 2012 development overview
Dynamics ax 2012 development overview
 
Dynamics AX 2009 Data Dictionary - Güven Şahin - 04.05.2013
Dynamics AX 2009 Data Dictionary - Güven Şahin - 04.05.2013Dynamics AX 2009 Data Dictionary - Güven Şahin - 04.05.2013
Dynamics AX 2009 Data Dictionary - Güven Şahin - 04.05.2013
 
X++ advanced course
X++ advanced courseX++ advanced course
X++ advanced course
 
ALV with Integrated Data Access
ALV with Integrated Data AccessALV with Integrated Data Access
ALV with Integrated Data Access
 
AX 2012 R3 Installation Guide
AX 2012 R3 Installation GuideAX 2012 R3 Installation Guide
AX 2012 R3 Installation Guide
 
Retail pos technical reference
Retail pos technical referenceRetail pos technical reference
Retail pos technical reference
 
Oracle XML Publisher / BI Publisher
Oracle XML Publisher / BI PublisherOracle XML Publisher / BI Publisher
Oracle XML Publisher / BI Publisher
 
Dynamics AX/ X++
Dynamics AX/ X++Dynamics AX/ X++
Dynamics AX/ X++
 
Chapter 02 sap script forms
Chapter 02 sap script formsChapter 02 sap script forms
Chapter 02 sap script forms
 
CDS Views.pptx
CDS Views.pptxCDS Views.pptx
CDS Views.pptx
 
Oracle BI Publsiher Using Data Template
Oracle BI Publsiher Using Data TemplateOracle BI Publsiher Using Data Template
Oracle BI Publsiher Using Data Template
 
Dynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay SharmaDynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay Sharma
 
Integration with dynamics ax 2012
Integration with dynamics ax 2012Integration with dynamics ax 2012
Integration with dynamics ax 2012
 
Sap Adobe Form
Sap Adobe FormSap Adobe Form
Sap Adobe Form
 
Job Control Language
Job Control LanguageJob Control Language
Job Control Language
 
Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basics
 
Jcl
JclJcl
Jcl
 
Idocs
IdocsIdocs
Idocs
 

Destacado

Dynamics ax performance tuning
Dynamics ax performance tuningDynamics ax performance tuning
Dynamics ax performance tuningOutsourceAX
 
Ax 2012 enterprise portal development
Ax 2012 enterprise portal developmentAx 2012 enterprise portal development
Ax 2012 enterprise portal developmentMoutasem Al-awa
 
Closed Loop Marketing (CLM)
Closed Loop Marketing (CLM)Closed Loop Marketing (CLM)
Closed Loop Marketing (CLM)Sai Kumar
 
Closed-loop Marketing Analytics
Closed-loop Marketing AnalyticsClosed-loop Marketing Analytics
Closed-loop Marketing AnalyticsDavid Delong
 
Microsft Dynamics AX Introduction
Microsft Dynamics AX IntroductionMicrosft Dynamics AX Introduction
Microsft Dynamics AX IntroductionMohamed Samy
 
Dynamic AX : Application Integration Framework
Dynamic AX : Application Integration FrameworkDynamic AX : Application Integration Framework
Dynamic AX : Application Integration FrameworkSaboor Ahmed
 

Destacado (8)

Azure overview
Azure overviewAzure overview
Azure overview
 
Dynamics ax performance tuning
Dynamics ax performance tuningDynamics ax performance tuning
Dynamics ax performance tuning
 
Ax 2012 enterprise portal development
Ax 2012 enterprise portal developmentAx 2012 enterprise portal development
Ax 2012 enterprise portal development
 
Closed Loop Marketing (CLM)
Closed Loop Marketing (CLM)Closed Loop Marketing (CLM)
Closed Loop Marketing (CLM)
 
CRM AT A GLANCE
CRM AT A GLANCECRM AT A GLANCE
CRM AT A GLANCE
 
Closed-loop Marketing Analytics
Closed-loop Marketing AnalyticsClosed-loop Marketing Analytics
Closed-loop Marketing Analytics
 
Microsft Dynamics AX Introduction
Microsft Dynamics AX IntroductionMicrosft Dynamics AX Introduction
Microsft Dynamics AX Introduction
 
Dynamic AX : Application Integration Framework
Dynamic AX : Application Integration FrameworkDynamic AX : Application Integration Framework
Dynamic AX : Application Integration Framework
 

Similar a Microsoft Dynamics AX 2012 - X++ Compiled to CIL

Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8Shakeel Mujahid
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notesWE-IT TUTORIALS
 
01. introduction to-programming
01. introduction to-programming01. introduction to-programming
01. introduction to-programmingStoian Kirov
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxNEHARAJPUT239591
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJmeharikiros2
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...bhargavi804095
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...bhargavi804095
 
01 Introduction to programming
01 Introduction to programming01 Introduction to programming
01 Introduction to programmingmaznabili
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docMayurWagh46
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfAnassElHousni
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1Sisir Ghosh
 
CI/CD Templates: Continuous Delivery of ML-Enabled Data Pipelines on Databricks
CI/CD Templates: Continuous Delivery of ML-Enabled Data Pipelines on DatabricksCI/CD Templates: Continuous Delivery of ML-Enabled Data Pipelines on Databricks
CI/CD Templates: Continuous Delivery of ML-Enabled Data Pipelines on DatabricksDatabricks
 
ASP.NET 01 - Introduction
ASP.NET 01 - IntroductionASP.NET 01 - Introduction
ASP.NET 01 - IntroductionRandy Connolly
 
414: Build an agile CI/CD Pipeline for application integration
414: Build an agile CI/CD Pipeline for application integration414: Build an agile CI/CD Pipeline for application integration
414: Build an agile CI/CD Pipeline for application integrationTrevor Dolby
 
DLL Design with Building Blocks
DLL Design with Building BlocksDLL Design with Building Blocks
DLL Design with Building BlocksMax Kleiner
 

Similar a Microsoft Dynamics AX 2012 - X++ Compiled to CIL (20)

T2
T2T2
T2
 
Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
 
01. introduction to-programming
01. introduction to-programming01. introduction to-programming
01. introduction to-programming
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
 
01 Introduction to programming
01 Introduction to programming01 Introduction to programming
01 Introduction to programming
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 
C Sharp Jn
C Sharp JnC Sharp Jn
C Sharp Jn
 
C Sharp Jn
C Sharp JnC Sharp Jn
C Sharp Jn
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1
 
Introduction to Programming Lesson 01
Introduction to Programming Lesson 01Introduction to Programming Lesson 01
Introduction to Programming Lesson 01
 
CI/CD Templates: Continuous Delivery of ML-Enabled Data Pipelines on Databricks
CI/CD Templates: Continuous Delivery of ML-Enabled Data Pipelines on DatabricksCI/CD Templates: Continuous Delivery of ML-Enabled Data Pipelines on Databricks
CI/CD Templates: Continuous Delivery of ML-Enabled Data Pipelines on Databricks
 
ASP.NET 01 - Introduction
ASP.NET 01 - IntroductionASP.NET 01 - Introduction
ASP.NET 01 - Introduction
 
414: Build an agile CI/CD Pipeline for application integration
414: Build an agile CI/CD Pipeline for application integration414: Build an agile CI/CD Pipeline for application integration
414: Build an agile CI/CD Pipeline for application integration
 
DLL Design with Building Blocks
DLL Design with Building BlocksDLL Design with Building Blocks
DLL Design with Building Blocks
 

Último

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 

Último (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Microsoft Dynamics AX 2012 - X++ Compiled to CIL

  • 1. Fabio Filardi Dynamics AX Technical Architect ffilardi@msbsgroup.com
  • 2. X++ Compiled to .NET CIL Overview Lesson 1: Generating CIL Lesson 2: How Process Works Lesson 3: Debugging CIL Code Lesson 4: Scenarios Not supported Lab: Code Sample
  • 3. Overview  Why Is X++ Compiled to CIL? The CLR can execute code faster than the AX kernel in the following cases: 1. Computationally intensive code that does not do a lot of database access 2. Memory intensive code where lots of object are built and stored in memory
  • 4. Overview  In Microsoft Dynamics AX 2012 X++ batch jobs, service classes, and code executed on the AOS calling the RunAs API are compiled into the common intermediate language (CIL or simply IL) of the .NET framework.  You can run your X++ code as CIL by using the method Global::runClassMethodIL.  Using "server" modifier in your methods or setting RunOn Server parameter won't make it run as IL necessarily.  The compilation creates an assembly called Dynamics.Ax.Application.dll which is stored on each AOS in the C:Program FilesMicrosoft Dynamics AX60ServerMicrosoftDynamicsAXbinXppIL folder.  The .NET CLR executes the code rather than the AX kernel.
  • 5. Overview RPC Services AOS • RunAs() • Batch Jobs • Services DB
  • 6. Lesson 1: Generating CIL This lesson outlines the steps to turn X++ code into generated CIL code  CIL Generation Steps Step Description 1. Write, save and compile your X++ class. The X++ source code for your class is automatically compiled into p-code when you save your source in the AOT. 2. Compile the p-code into CIL X++ is compiled into .NET CIL code. 3. Restart your multiple AOS services. If your installation has more than one AOS, you need to restart every AOS service after the CIL build completes. The recycle causes each AOS to load the assembly that contains the updated CIL. 4. Call the class. Schedule the batch job that executes your class or call the service class.
  • 7. Lesson 1: Generating CIL This lesson outlines the steps to turn X++ code into generated CIL code  CIL Compilation Options For step #2 on the previous slide, Compile the p-code into CIL, two options are available: 1. Generate Full CIL This option goes through the AOT and generates the CIL for all the modified objects that will be used in batch processes or as service classes. 2. Generate Incremental CIL This option causes the CIL to be generated for all objects that have been modified since the last time the assembly was generated.
  • 8. Lesson 1: Generating CIL This lesson outlines the steps to turn X++ code into generated CIL code  Generating CIL Code in the Developer Workspace Right-click the AOT node of the AOT, and navigate to the Add-Ins menu. The last two options on the menu will allow you to select the desired CIL option: You can also use the Build menu:
  • 9. Lesson 1: Generating CIL This lesson outlines the steps to turn X++ code into generated CIL code  Generating CIL Code in the Application Workspace As the Administrator navigate to the System administration menu in Microsoft Dynamics AX, and then under Periodic, choose ‘Compile into .NET Framework CIL’: Important: This does a Full CIL generation.
  • 10. Lesson 1: Generating CIL This lesson outlines the steps to turn X++ code into generated CIL code  Restart AOS Instances Step #3 in the CIL Generation Process is restart your multiple AOS services. After the assembly containing the CIL code has been created, the AOS used for the CIL generation has the current version of the assembly. However, other AOS have outdated code. To resolve this, the other AOS have to be restarted.
  • 11. Lesson 2: How Process Works This lesson explains the process to compile and execute CIL code  Create and compile Objects created in Microsoft Dynamics AX 2012 are stored in the "metadata store". In prior versions of Microsoft Dynamics AX, this information was stored in the *.AOD files. In Microsoft Dynamics AX 2012, the metadata store has been moved into SQL Server. X++ compiler examines the object information in the metadata store and generates the p-code for that object. When the object is needed, the p-code is then executed by the X++ interpreter. When the CIL generation is done, the Microsoft Dynamics AX generates an XML file that contains a representation of the code based on the metadata for the object, and the p-code that exists for that same object. The IL generator will generate an assembly and a *.PDB file from the XML.
  • 12. Lesson 2: How Process Works This lesson explains the process to compile and execute CIL code  CIL Generation X++ PCode . PDB DLL
  • 13. Lesson 2: How Process Works This lesson explains the process to compile and execute CIL code  Netmodules and FileSystem If a single class changes, only the module that contains it needs to change while all the other types remain untouched. Microsoft Dynamics AX 2012 uses an algorithm that is based on the object type that is used to determine the ID number value for each netmodule. In the file system, the assembly will be represented as one dll file and thousands of netmodules files:
  • 14. Lesson 2: How Process Works This lesson explains the process to compile and execute CIL code  Moving Databases between Environments The assembly containing the CIL code is stored in the database, and the version of the assembly in the database will be restored to the system if the database and file system versions are different. This is an attention point when updating the development environment with another database, like client production/homolog database.
  • 15. Lesson 3: Debugging CIL Code This lesson explains how to debug the .NET CIL code created by Dynamics AX  Requirements for Debugging  To debug CIL code the AOS must have Debugging enabled via the Server configuration utility. If debugging on the AOS is not enabled, the source for the X++ code that will be displayed in the debugger is not available, and an error is displayed in Visual Studio when you attempt to view the X++ source code for an object.  Visual Studio 2010 (VS) must be installed on the AOS. To debug CIL code you have to attach to the AX32Serv.exe process in Visual Studio. This is not possible if Visual Studio is not installed on the AOS.
  • 16. Lesson 3: Debugging CIL Code This lesson explains how to debug the .NET CIL code created by Dynamics AX  How to Debug CIL Code 1. On the AOS in VS click Tools, and then click Attach to Process. 2. In the form that opens mark the checkboxes for Show processes from all users and Show processes in all sessions. 3. Select AX32Serv.exe. 4. Click Attach. 5. In VS open the Application Explorer and locate the class or method you want to debug. The Application Explorer is simply a read only representation of the AOT, you navigate as you would the AOT in Microsoft Dynamics AX. 6. Set a breakpoint in the method. 7. Execute the batch process or call the service class. When the execution arrives at the breakpoint, the Visual Studio debugger provides all the functionality that it does for all other .NET languages.
  • 17. Lesson 3: Debugging CIL Code This lesson explains how to debug the .NET CIL code created by Dynamics AX  VS Attach to Process - Screen Example
  • 18. Lesson 3: Debugging CIL Code This lesson explains how to debug the .NET CIL code created by Dynamics AX  VS Debugging AX Class - Screen Example
  • 19. Lesson 4: Scenarios Not Supported This lesson explains where we can't use CIL code  Scenarios not supported and restrictions  Functions There are two X++ functions not supported in CIL: evalbuf and runbuf.  Incremental CIL Generation Restriction Remove a method: a full generation of CIL for the class is necessary to remove the method from the existing CIL.  Compile outcome when a class has one bad method The X++ compiler still generates valid p-code for methods that contain no errors, even after another method on the same class has been failed to compile. But when a full compile of X++ p-code to CIL is performed, the entire compile fails if valid p-code is unavailable for any method on any class. Until your system has a successful full CIL compile, your system cannot run services, SSRS reports, or batch jobs.
  • 20. Lesson 4: Scenarios Not Supported This lesson explains where we can't use CIL code  Methods on Queries and Forms Class and tables are types in the X++ language. They can be compiled to CIL. The queries and forms in the AOT are not X++ types, and they cannot be compiled to CIL. This means there are a few minor cases where calls from CIL to X++ p-code can cause an exception. The problem is that the CIL session does not have access to all the system classes.
  • 21. Lab: Code Sample This lab shows two samples to illustrate CIL vs Pcode execution In this example we will use a simple condition to check if the active session is a CLR Session or not, called direct and by runClassMethodIL. 1. Create a class with main() and an additional method: 2. Generate Incremental CIL, and execute the class. Result:
  • 22. Lab: Code Sample This lab shows two samples to illustrate CIL vs Pcode execution In this example we will use a counter to show that the CIL run completed much faster than the interpreted run. 1. First, create a class (named DemoClassCIL) with main() and 3 additional methods:
  • 23. Lab: Code Sample This lab shows two samples to illustrate CIL vs Pcode execution
  • 24. Lab: Code Sample This lab shows two examples to illustrate CIL vs Pcode execution Generate Incremental IL and execute the class. The result is something like below: As seen above, the result in this example was about 40x faster when executed in CIL.
  • 25. X++ Compiled to .NET CIL That s all, thanks.