I recently encountered an issue where a code promotion was done from a staging environment to a production environment and, the next day, the AOS'es would all crash in both client and batch (server) mode when a process not relating to the code promotion (Invoicing) was run. The code all compiled in PROD and everything was working great during all tests in lower environments.
Simple solution:
Run a compile forward on any base class (eg Classes\CustVendSettle) affected from the previous promotion.
The journey to this solution:
After looking at the AX Crash Dump file, we were able to extract out the call stack to determine where the crash was occurring. It pointed to a class (eg CustVendSettle_VendPaym) inheriting a base class (eg CustVendSettle) looking for a global variable that was found in the CustVendSettle class. The references to CustVendSettle were not updated for the CustVendSettle_VendPaym class. This was causing the AOS to crash.
The take away:
I normally compile forward when errors are received in the process being imported. There were no errors on this import and the process in PROD was running fine during the weekend validation testing.
There is a difference between a compile and compile forward. A compile just compiles the class that is compiled. A compile forward on the main (eg CustVendSettle) will compile that class as well as update the references to that for all class that inherit it (eg CustVendSettle_Cust, CustVendSettle_VendPaym, etc).
A compile forward will not run automatically on import and all classes could compile successfully if just compiled. Anytime a change is made to a base class involved in inheritance (eg CustVendSettle, SalesFormLetter, etc), a compile forward on that class is needed. A good example of something that would be guaranteed to need this is making a change in the classDeclaration on a class that is inherited.
In AX 2009, a compile forward can be done by right-clicking on the object that is inherited, go to 'Add-Ins', then 'Compile forward'. Once this was done, the process worked and no longer crashed the AOS. Hooray...
Hope that helps anyone hitting the same issue.
No comments:
Post a Comment