Debugging Batch Jobs

Show me the developer who doesn’t love breakpoints? They are the best thing since sliced bread and double monitors.

So how can one set a breakpoint in managed code? It’s actually not that hard.

The problem here is that the standard AX debugger can only debug interpreted code. But since we have CLR code we can use our trusty Visual Studio.

Here are the steps:

1.  Be sure breakpoints are enabled on AOS configuration
2.  Start Microsoft Visual Studio with admin rights
3.  Go to Debug and choose Attach to process

Attach to process

Attach to process

4.  Select the AX32Serv.exe process (make sure Show processes for all users and Show processes in all sessions are checked) and click Attach.

AX32Serv.exe

AX32Serv.exe

5.  A warning will pop up about a “suspicious” process. This is our process so just select Attach again.

6.  Now just go to the batch job you want to run and set a breakpoint.

Breakpoint

Breakpoint

7.  From Dynamics AX run the Job in batch

In case you get a breakpoint that is not red and when the cursor is on top of it it displays a message

“The breakpoint will not currently be hit. No symbols have been loaded for this document.”

don’t worry. If the xpps are loaded correctly and the xppil lib exists you will hit the breakpoint.

If not, just generate a fll CIL and/or restart the AX service.

Empty Breakpoint

Empty Breakpoint

 

Hope you enjoyed my post and in case you have a question don’t hesitate to leave a comment!

Posted in Tools and tagged , .

Leave a Reply

Your email address will not be published. Required fields are marked *