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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Error executing code: Illegal object code. Recompile script

(0) ShareShare
ReportReport
Posted on by 48,693 User Group Leader

I have a standard AX class, as I add any new line of code in it and try to run my process following error message appears

Error executing code: Illegal object code. Recompile script.

Stack trace

.....

Now the point is, I am able to compile this class,

There is no syntax error, there is no error in Generation of CIL, as well.

 

*This post is locked for comments

I have the same question (0)
  • Anton Venter Profile Picture
    20,291 Super User 2025 Season 2 on at
    RE: Error executing code: Illegal object code. Recompile script

    Hi Sohaib, what steps did you take to try and solve it? Full compile and full CIL compile?

  • Sohaib Cheema Profile Picture
    48,693 User Group Leader on at
    RE: Error executing code: Illegal object code. Recompile script

    I have tried following things:

    1. Generated Incremental CIL
    2. Exported class and reimport
    3. Generated Full CIL
    4. Cleared Usage Data
    5. Compile Forward

    seems something really nasty.

  • André Arnaud de Calavon Profile Picture
    299,071 Super User 2025 Season 2 on at
    RE: Error executing code: Illegal object code. Recompile script

    Hi Sohaib,

    Can you tell which class was involved and what line of code you added?

    If this class is inherited, try to find the base class and do a compile forward.

  • Sohaib Cheema Profile Picture
    48,693 User Group Leader on at
    RE: Error executing code: Illegal object code. Recompile script

    The class in which I am doing customization is CustVoucher.

    Here is line of code, which I am adding, inside the method newCustVoucherJournal

     

    custVoucher.parmLedgerJournalTransID(_ledgerJournalTrans.RecId);

     

    parmLedgerJournalTransID is method which has been created in class CustVendVoucher

    I have compiled CustVendVoucher, too

  • Verified answer
    André Arnaud de Calavon Profile Picture
    299,071 Super User 2025 Season 2 on at
    RE: Error executing code: Illegal object code. Recompile script

    Hi Sohaib,

    The method parmLedgerJournalTransID is expecting one variable of a type Int64?

    You can try to disable the user option 'Execute business logic in CIL' to see if it can be executed without using CIL.

    To be sure, you can also try a full x++ compile prior to the CIL compilation.

  • Sohaib Cheema Profile Picture
    48,693 User Group Leader on at
    RE: Error executing code: Illegal object code. Recompile script

    Andre,

    the method parmLedgerJournalTransID  is customized method

    i am passing value by _ledgerJournalTrans.RecId as int64 type value.

    Let me try again with full compile and generation of CIL again.

  • Verified answer
    Sohaib Cheema Profile Picture
    48,693 User Group Leader on at
    RE: Error executing code: Illegal object code. Recompile script

    Issue has resolved by doing following:

    • Took a backup of Customization
    • Deleted Customized Object (Class) which was raising issue.
    • Made a full Compilation and generated Full CIL
    • Re-imported Customized Lines of code Using Compare Tool
    • Saved and Compiled Customized Objects
    • Generated Incremental CIL

     

     

  • Community Member Profile Picture
    on at
    RE: Error executing code: Illegal object code. Recompile script

    i have the same error it shows to me when i import opening balance ( ledger with dimension ) Error executing code: Illegal object code. Recompile script.

    this error only happen when i import ledger dimension

    i have import ledger many times and i don't have problem

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans