Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Batch job keeps retrieving old code

(0) ShareShare
ReportReport
Posted on by 1,085

Hi,

i've got a scheduled batch (RunBaseBatch Class) which calls a method in another Class (MyClass)

Class "MyClass" needed a fix in its code.

Now the scheduled batch seems to keep finding the old version of "MyClass".

Is there any workaround for this issue? (I mean, except rescheduling the RunBaseBatch job...)

Thank you in advance

regards

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Batch job keeps retrieving old code

    Thank you, full CIL generation did the trick and thank you for the command line script.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Batch job keeps retrieving old code

    You could start the AX client from the management shell both in interactive, and "minimized" mode to run in the background and trigger a Full CIL if required. Here you go: community.dynamics.com/.../121172

    Try something like:

    & "C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe" -startupCmd=CompileIL

  • Community Member Profile Picture
    on at
    RE: Batch job keeps retrieving old code

    honestly I've been skipping this step for all our production releases because I had the misunderstanding compile would include generating CIL.. yikes.

    So to confirm, I would have to do 'Generate Full CIL' in development workspace. The steps for full pre-production build is

    1) Stop AOS

    2) Compile 64-bit

    3) Start AOS

    4) Generate Full CIL

    5) Synchronize

    Is there a way to generate CIL through the management shell?

  • Martin Dráb Profile Picture
    231,833 Most Valuable Professional on at
    RE: Batch job keeps retrieving old code

    You didn't mention generating CIL, which would explain this behavior. Compiling X++ isn't enough, you have to generate CIL as well.

    Ideally this should be done in a pre-prod environment and moved to production as the whole modelstore (which includes compiled X++ and CIL).

  • Community Member Profile Picture
    on at
    RE: Batch job keeps retrieving old code

    I'm having the same issue in our production system it seems, however restarting the service hasn't done the trick. We don't have a separate batch server.

    Context: An existing class was modified that was linked to an existing batch job, let's call it class MyClass. MyClass runs as expected through an AoT job or from a menu item which directly calls MyClass. However the batch job behaves as if reading the older code. After successfully reproducing the issue on a dev environment and debugging through Visual Studios, we were able to confirm the batch job was pulling the old code.

    So a couple of troubleshooting steps I took so far, all unsuccessful though:

    1) Restart AOS
    2) Stop AOS, full 64-bit compile, Start AOS, synchronize (Let's call that Full Compile)

    3) Removed all entries in dbo.SysLastValue, full compile
    4) Changed 'Current Version' for pack/unpack methods for MyClass, full compile

    5) Set the GlobalUID to 0's, full compile

    Anything else I could try?

    System: AX 2012 R3 

  • Community Member Profile Picture
    on at
    RE: Batch job keeps retrieving old code

    Prabath's restart worked for me. I was experiencing the same issue. I have a minimalistic runbase class that runs nightly to create a sort of a snapshot/speed table. I updated the class and promoted it up. I noticed that the results from the nightly run weren't coming out as expected. During troubleshooting I noticed that if I ran the class from MorphX (not batch) that it produced the intended results, but if I ran the class from MorphX in batch it would not. RDP into batch server, stop service, start service, test results, and everything is good to go.

  • Suggested answer
    Prabath Profile Picture
    665 on at
    RE: Batch job keeps retrieving old code

    Did you restarted the batch server and try?

  • Martin Dráb Profile Picture
    231,833 Most Valuable Professional on at
    RE: Batch job keeps retrieving old code

    The problem may be in incorrect compilation (compiling just the modified object isn't enough in some cases), a cache, wrong detection from your side or who knows...

    I can't do more with the current amount of information.

  • vv1984 Profile Picture
    1,085 on at
    RE: Batch job keeps retrieving old code

    Yes, but a part from the error I get, the point is finding the reason why the batch job keeps retrieving the old code of my ModifiedClass, even if it has been already recompiled.

    I think I should have not recompiled ScheduledClass, since no edits has been made on its code. Only my ModifiedClass has been modified...

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,001 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,833 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans