SlideShare ist ein Scribd-Unternehmen logo
1 von 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.

Weitere ähnliche Inhalte

Was ist angesagt?

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
 
AX 2012: All About Lookups!
AX 2012: All About Lookups!AX 2012: All About Lookups!
AX 2012: All About Lookups!MAnasKhan
 
Microsoft Dynamics AX 2012 - Services Overview
Microsoft Dynamics AX 2012 - Services OverviewMicrosoft Dynamics AX 2012 - Services Overview
Microsoft Dynamics AX 2012 - Services OverviewFabio Filardi
 
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
 
X++ advanced course
X++ advanced courseX++ advanced course
X++ advanced courseAlvin You
 
Integration with dynamics ax 2012
Integration with dynamics ax 2012Integration with dynamics ax 2012
Integration with dynamics ax 2012Ali Raza Zaidi
 
Dynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay SharmaDynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay SharmaVijay Sharma
 
Sql Server Management Studio Tips and Tricks
Sql Server Management Studio Tips and TricksSql Server Management Studio Tips and Tricks
Sql Server Management Studio Tips and TricksAndrea Allred
 
Multiple files single target single interface
Multiple files single target single interfaceMultiple files single target single interface
Multiple files single target single interfaceDharmaraj Borse
 
Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overviewhonglee71
 
Add or Remove Password Protection in Excel 2016
Add or Remove Password Protection in Excel 2016Add or Remove Password Protection in Excel 2016
Add or Remove Password Protection in Excel 2016Jaff Tiger
 
Ssrs introduction session 1
Ssrs introduction session 1Ssrs introduction session 1
Ssrs introduction session 1Muthuvel P
 
Creating and Managing Tables -Oracle Data base
Creating and Managing Tables -Oracle Data base Creating and Managing Tables -Oracle Data base
Creating and Managing Tables -Oracle Data base Salman Memon
 
Developer's guide to customization
Developer's guide to customizationDeveloper's guide to customization
Developer's guide to customizationAhmed Farag
 

Was ist angesagt? (20)

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
 
AX 2012: All About Lookups!
AX 2012: All About Lookups!AX 2012: All About Lookups!
AX 2012: All About Lookups!
 
Microsoft Dynamics AX 2012 - Services Overview
Microsoft Dynamics AX 2012 - Services OverviewMicrosoft Dynamics AX 2012 - Services Overview
Microsoft Dynamics AX 2012 - Services Overview
 
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
 
X++ advanced course
X++ advanced courseX++ advanced course
X++ advanced course
 
Integration with dynamics ax 2012
Integration with dynamics ax 2012Integration with dynamics ax 2012
Integration with dynamics ax 2012
 
Dynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay SharmaDynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay Sharma
 
SQL
SQLSQL
SQL
 
MS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTUREMS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTURE
 
Sql Server Management Studio Tips and Tricks
Sql Server Management Studio Tips and TricksSql Server Management Studio Tips and Tricks
Sql Server Management Studio Tips and Tricks
 
Multiple files single target single interface
Multiple files single target single interfaceMultiple files single target single interface
Multiple files single target single interface
 
Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overview
 
Database
DatabaseDatabase
Database
 
Dynamics AX/ X++
Dynamics AX/ X++Dynamics AX/ X++
Dynamics AX/ X++
 
Sql Server Basics
Sql Server BasicsSql Server Basics
Sql Server Basics
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Add or Remove Password Protection in Excel 2016
Add or Remove Password Protection in Excel 2016Add or Remove Password Protection in Excel 2016
Add or Remove Password Protection in Excel 2016
 
Ssrs introduction session 1
Ssrs introduction session 1Ssrs introduction session 1
Ssrs introduction session 1
 
Creating and Managing Tables -Oracle Data base
Creating and Managing Tables -Oracle Data base Creating and Managing Tables -Oracle Data base
Creating and Managing Tables -Oracle Data base
 
Developer's guide to customization
Developer's guide to customizationDeveloper's guide to customization
Developer's guide to customization
 

Andere mochten auch

AX 2012 R3 Installation Guide
AX 2012 R3 Installation GuideAX 2012 R3 Installation Guide
AX 2012 R3 Installation GuideBiswanath Dey
 
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
 

Andere mochten auch (9)

Azure overview
Azure overviewAzure overview
Azure overview
 
AX 2012 R3 Installation Guide
AX 2012 R3 Installation GuideAX 2012 R3 Installation Guide
AX 2012 R3 Installation Guide
 
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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
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
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
[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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
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
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Kürzlich hochgeladen (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
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
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
[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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
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
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

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.